From a1cfb7e1078e07af80de617689bb1c1e6a65ec46 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 12 Dec 2023 02:57:58 +0100 Subject: chore: resolve binary Node instance --- app/CMark/Extra.hs | 23 +++++++++++++++++++++++ app/Issue.hs | 9 +-------- 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 app/CMark/Extra.hs (limited to 'app') 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 -- cgit v1.2.3