aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Issue.hs')
-rw-r--r--app/Issue.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/Issue.hs b/app/Issue.hs
index ba8baa8..f7227f1 100644
--- a/app/Issue.hs
+++ b/app/Issue.hs
@@ -1,10 +1,12 @@
{-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DisambiguateRecordFields #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}
module Issue (Issue (..), Provenance (..), fromMatch, id) where
+import Data.Binary (Binary, get, put)
import Data.ByteString.Lazy (toStrict)
import Data.ByteString.Lazy.Char8 (unpack)
import Data.List (find, foldl')
@@ -13,6 +15,7 @@ import Data.Text (Text)
import Data.Text qualified as T
import Data.Text.Encoding (decodeUtf8)
import Data.Time.Clock (UTCTime)
+import GHC.Generics (Generic)
import Issue.Tag (Tag (..))
import Issue.Tag qualified as I
import Issue.Text qualified as I
@@ -34,7 +37,7 @@ data Issue = Issue
tags :: [Tag],
internalTags :: [Tag]
}
- deriving (Show)
+ deriving (Show, Binary, Generic)
data Provenance = Provenance
{ firstCommit :: Text,
@@ -42,7 +45,12 @@ data Provenance = Provenance
authorEmail :: Text,
authorName :: Text
}
- deriving (Show)
+ deriving (Show, Generic, Binary)
+
+instance Binary UTCTime where
+ -- TODO Serialize UTCTime using POSIX time stamps
+ put = put . show
+ get = fmap read get
id :: Issue -> Maybe String
id issue =