From 02b07b70d81fa0c0606825e9485f99c7c738b1c4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 19 Nov 2015 17:25:28 -0800 Subject: [PATCH] Add a `before` function. --- src/Patch.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Patch.hs b/src/Patch.hs index ca56bbc68..2b2f3bcef 100644 --- a/src/Patch.hs +++ b/src/Patch.hs @@ -10,3 +10,8 @@ after :: Patch a -> Maybe a after (Replace _ a) = Just a after (Insert a) = Just a after _ = Nothing + +before :: Patch a -> Maybe a +before (Replace a _) = Just a +before (Delete a) = Just a +before _ = Nothing