aboutsummaryrefslogtreecommitdiffstats
path: root/src/Verismith/Result.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2019-11-12 16:51:32 +0000
committerYann Herklotz <git@yannherklotz.com>2019-11-12 16:51:32 +0000
commit02849780204c36fd9c130a398c0a6901b461f8f5 (patch)
tree7145e35f751661120641329568afa7797902009a /src/Verismith/Result.hs
parent9d2bddfa46b0e4b80f7cf8b30769dec49e1ed423 (diff)
downloadverismith-02849780204c36fd9c130a398c0a6901b461f8f5.tar.gz
verismith-02849780204c36fd9c130a398c0a6901b461f8f5.zip
Add reduction for simulation failures
Diffstat (limited to 'src/Verismith/Result.hs')
-rw-r--r--src/Verismith/Result.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Verismith/Result.hs b/src/Verismith/Result.hs
index d8efd2f..2ecb728 100644
--- a/src/Verismith/Result.hs
+++ b/src/Verismith/Result.hs
@@ -22,6 +22,8 @@ needed in "Verismith".
module Verismith.Result
( Result(..)
, ResultT(..)
+ , justPass
+ , justFail
, (<?>)
, annotate
)
@@ -42,6 +44,14 @@ data Result a b = Fail a
| Pass b
deriving (Eq, Show)
+justPass :: Result a b -> Maybe b
+justPass (Fail _) = Nothing
+justPass (Pass a) = Just a
+
+justFail :: Result a b -> Maybe a
+justFail (Pass _) = Nothing
+justFail (Fail a) = Just a
+
instance Semigroup (Result a b) where
Pass _ <> a = a
a <> _ = a