From 02849780204c36fd9c130a398c0a6901b461f8f5 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 12 Nov 2019 16:51:32 +0000 Subject: Add reduction for simulation failures --- src/Verismith/Result.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Verismith/Result.hs') 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 -- cgit