diff --git a/src/Control/Abstract/Value.hs b/src/Control/Abstract/Value.hs index ebda63d6b..3645fc4f4 100644 --- a/src/Control/Abstract/Value.hs +++ b/src/Control/Abstract/Value.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE GADTs, Rank2Types #-} +{-# LANGUAGE GADTs, KindSignatures, Rank2Types #-} module Control.Abstract.Value ( AbstractValue(..) , AbstractIntro(..) @@ -73,6 +73,16 @@ instance PureEffect (Function address value) where handle handler (Request (Call fn self addrs) k) = Request (Call fn self addrs) (handler . k) +data Boolean value (m :: * -> *) result where + Boolean :: Bool -> Boolean value m value + AsBool :: value -> Boolean value m Bool + +instance PureEffect (Boolean value) +instance Effect (Boolean value) where + handleState state handler (Request (Boolean b) k) = Request (Boolean b) (handler . (<$ state) . k) + handleState state handler (Request (AsBool v) k) = Request (AsBool v) (handler . (<$ state) . k) + + class Show value => AbstractIntro value where -- | Construct an abstract unit value. -- TODO: This might be the same as the empty tuple for some value types