aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Issue.hs')
-rw-r--r--app/Issue.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/app/Issue.hs b/app/Issue.hs
index 65afdd6..303862d 100644
--- a/app/Issue.hs
+++ b/app/Issue.hs
@@ -1,3 +1,5 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
module Issue
( Issue (..),
Provenance (..),
@@ -7,7 +9,9 @@ module Issue
)
where
-import Data.Binary (Binary)
+import CMark qualified as D
+import Data.Binary (Binary (..))
+import Data.List.NonEmpty (NonEmpty)
import Data.Text qualified as T
import Data.Text.IO qualified as T
import Data.Time.Clock (UTCTime (utctDay))
@@ -15,13 +19,14 @@ import GHC.Generics (Generic)
import GHC.Records (HasField (..))
import Issue.Provenance (Author (..), Commit (..), Provenance (..))
import Issue.Tag (Tag (..))
+import Render qualified as P
import TreeGrepper.Comment qualified as G
import TreeGrepper.Match qualified as G
import Prelude hiding (id)
data Issue = Issue
{ title :: T.Text,
- description :: Maybe T.Text,
+ description :: Maybe (NonEmpty D.Node),
file :: String,
provenance :: Provenance,
start :: G.Position,
@@ -30,11 +35,18 @@ data Issue = Issue
markers :: [T.Text],
rawText :: T.Text,
commentStyle :: G.CommentStyle,
- comments :: [T.Text],
+ comments :: Maybe (NonEmpty [D.Node]),
closed :: Bool
}
deriving (Show, Binary, Generic, Eq)
+-- TODO Resolve Binary D.Node instance
+--
+-- @related reduce-cached-data-size
+instance Binary D.Node where
+ put = put . show . P.render
+ get = D.commonmarkToNode [] <$> get
+
id :: Issue -> T.Text
id issue = toSpinalCase issue.title
where