aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue.hs
diff options
context:
space:
mode:
authorLibravatar Fabian Kirchner <kirchner@posteo.de>2023-10-14 12:11:38 +0200
committerLibravatar Fabian Kirchner <kirchner@posteo.de>2023-10-14 12:11:38 +0200
commitef5f4581f31ec35a4b2afefbafac56f175566879 (patch)
treefacf9420cd3eb7baaa309afa732f8823522dfca0 /app/Issue.hs
parent9806a5284d0f189da90ea0020441b8d6f96daee9 (diff)
add basic caching of Issue's
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 =