aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-12 04:06:44 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-12 04:06:44 +0100
commitf1e66f3b9a5b85c57180977512dac089faa9b04b (patch)
tree95a1dc8781acfabd8e98db14e30fc9318da45784 /app
parent55cd938ef7c97eaf0008f83d51668bbf12dc77d8 (diff)
chore: resolve binary orphans
Diffstat (limited to 'app')
-rw-r--r--app/Git.hs25
1 files changed, 3 insertions, 22 deletions
diff --git a/app/Git.hs b/app/Git.hs
index b4e36e1..be95f61 100644
--- a/app/Git.hs
+++ b/app/Git.hs
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-
module Git
( module Git.CommitHash,
getCommitHashes,
@@ -13,9 +11,9 @@ module Git
where
import Control.Exception (IOException, catch, throw, throwIO)
-import Data.Binary (Binary, Put, get, put)
+import Data.Binary (Binary)
+import Data.Binary.Instances ()
import Data.ByteString.Lazy qualified as LB
-import Data.Fixed (Pico)
import Data.List.NonEmpty (NonEmpty)
import Data.List.NonEmpty qualified as N
import Data.Maybe (fromMaybe)
@@ -24,8 +22,7 @@ import Data.Text.Encoding qualified as T
import Data.Text.Lazy qualified as LT
import Data.Text.Lazy.Encoding qualified as LT
import Data.Text.Lazy.IO qualified as LT
-import Data.Time.Calendar (Day (..), toModifiedJulianDay)
-import Data.Time.Clock (DiffTime, UTCTime (..), getCurrentTime, picosecondsToDiffTime)
+import Data.Time.Clock (UTCTime, getCurrentTime)
import Exception qualified as E
import GHC.Generics (Generic)
import Git.CommitHash
@@ -62,22 +59,6 @@ data Author = Author
}
deriving (Show, Generic, Binary, Eq)
--- XXX These are taken from `Data.Binary.Orphans` [1]. I cannot get importing
--- the instance from the package to work.. so we use `-fno-warn-orphans` here.
---
--- [1] https://hackage.haskell.org/package/binary-orphans-0.1.5.1/docs/src/Data-Binary-Orphans.html#line-132
-instance Binary UTCTime where
- get = UTCTime <$> get <*> get
- put (UTCTime d dt) = put d >> put dt
-
-instance Binary Day where
- get = fmap ModifiedJulianDay get
- put = put . toModifiedJulianDay
-
-instance Binary DiffTime where
- get = fmap picosecondsToDiffTime get
- put = (put :: Pico -> Put) . realToFrac
-
getCommitOf :: CommitHash -> IO Commit
getCommitOf commitHash@WorkingTree = do
date <- getCurrentTime