aboutsummaryrefslogtreecommitdiffstats
path: root/app/Patch.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-07 03:55:45 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-07 03:55:47 +0100
commit3c6e62b75293b6625509ade3c278fc2d4d147c30 (patch)
treeb33f76c2634a771879f9178cff8e5335e43d2f43 /app/Patch.hs
parenta5dde0c6e1c1f54a1660f6c2345277927beef30f (diff)
chore: increase performance by caching everything
Initial cache generation is slower, as we are losing out on parallelism.
Diffstat (limited to 'app/Patch.hs')
-rw-r--r--app/Patch.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/Patch.hs b/app/Patch.hs
index 0600a34..9e6ed88 100644
--- a/app/Patch.hs
+++ b/app/Patch.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE DerivingStrategies #-}
+
module Patch
( Patch,
parse,
@@ -5,17 +7,21 @@ module Patch
where
import Control.Exception (throw)
+import Data.Binary (Binary (..))
import Data.Text qualified as T
import Exception qualified as E
+import GHC.Generics (Generic)
import Render ((<<<))
import Render qualified as P
+import Text.Diff.Extra ()
import Text.Diff.Parse qualified as D
import Text.Diff.Parse.Types qualified as D
newtype Patch = Patch
{ fileDeltas :: D.FileDeltas
}
- deriving (Show)
+ deriving (Show, Generic)
+ deriving newtype (Binary)
parse :: T.Text -> Patch
parse = either (throw . E.InvalidDiff) Patch . D.parseDiff