aboutsummaryrefslogtreecommitdiffstats
path: root/app/Patch.hs
diff options
context:
space:
mode:
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