From 3c6e62b75293b6625509ade3c278fc2d4d147c30 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 7 Dec 2023 03:55:45 +0100 Subject: chore: increase performance by caching everything Initial cache generation is slower, as we are losing out on parallelism. --- app/Patch.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/Patch.hs') 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 -- cgit v1.2.3