diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-12 02:57:58 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-12-12 04:00:22 +0100 |
commit | a1cfb7e1078e07af80de617689bb1c1e6a65ec46 (patch) | |
tree | dd6e10931a3fed50c09158f01dac99c2b23af005 | |
parent | c553d97f53ac0efc144413444012932125ad9a55 (diff) |
chore: resolve binary Node instance
-rw-r--r-- | anissue.cabal | 1 | ||||
-rw-r--r-- | app/CMark/Extra.hs | 23 | ||||
-rw-r--r-- | app/Issue.hs | 9 |
3 files changed, 25 insertions, 8 deletions
diff --git a/anissue.cabal b/anissue.cabal index 42e7c97..b6929d8 100644 --- a/anissue.cabal +++ b/anissue.cabal @@ -67,6 +67,7 @@ executable anissue -- Modules included in this executable, other than Main. other-modules: Cache + CMark.Extra Comment Comment.Language Data.List.Extra diff --git a/app/CMark/Extra.hs b/app/CMark/Extra.hs new file mode 100644 index 0000000..1d7d553 --- /dev/null +++ b/app/CMark/Extra.hs @@ -0,0 +1,23 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module CMark.Extra where + +import CMark +import Data.Binary (Binary) + +-- TODO Generic-derived Binary instances might be slow +-- +-- https://github.com/kolmodin/binary/issues/200 +-- +-- @backlog +instance Binary Node + +instance Binary PosInfo + +instance Binary NodeType + +instance Binary ListAttributes + +instance Binary ListType + +instance Binary DelimType diff --git a/app/Issue.hs b/app/Issue.hs index 4c5cc97..124b0d7 100644 --- a/app/Issue.hs +++ b/app/Issue.hs @@ -10,6 +10,7 @@ module Issue where import CMark qualified as D +import CMark.Extra () import Comment qualified as G import Data.Binary (Binary (..)) import Data.List.NonEmpty (NonEmpty) @@ -21,7 +22,6 @@ import GHC.Records (HasField (..)) import Git (Author (..), Commit (..)) import Issue.Provenance (Provenance (..)) import Issue.Tag (Tag (..)) -import Render qualified as P import Prelude hiding (id) data Issue = Issue @@ -40,13 +40,6 @@ data Issue = Issue } deriving (Show, Binary, Generic, Eq) --- TODO Resolve Binary D.Node instance --- --- @related reduce-cached-data-size -instance Binary D.Node where - put = put . T.pack . show . P.render - get = D.commonmarkToNode [] <$> get - id :: Issue -> T.Text id issue = toSpinalCase issue.title where |