aboutsummaryrefslogtreecommitdiffstats
path: root/app/IssueEvent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/IssueEvent.hs')
-rw-r--r--app/IssueEvent.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/IssueEvent.hs b/app/IssueEvent.hs
index c82dba5..0c641ad 100644
--- a/app/IssueEvent.hs
+++ b/app/IssueEvent.hs
@@ -5,6 +5,7 @@ module IssueEvent
)
where
+import Control.Monad (join)
import Data.Binary (Binary (..))
import Data.Function ((&))
import Data.Text qualified as T
@@ -42,9 +43,9 @@ data IssueEvent
deriving (Show, Generic, Binary)
instance HasField "patch" IssueEvent (IO Patch) where
- getField (IssueCreated {..}) = diff "" issue.rawText
- getField (IssueChanged {..}) = diff oldIssue.rawText issue.rawText
- getField (IssueDeleted {..}) = diff issue.rawText ""
+ getField (IssueCreated {..}) = join $ (diff "" <$> issue.rawText)
+ getField (IssueChanged {..}) = join $ (diff <$> oldIssue.rawText <*> issue.rawText)
+ getField (IssueDeleted {..}) = join $ (flip diff "" <$> issue.rawText)
diff :: T.Text -> T.Text -> IO A.Patch
diff old new = withSystemTempDirectory "diff" $ \tmp -> do