mirror of
https://github.com/github/semantic.git
synced 2024-12-26 08:25:19 +03:00
Define a Boolean effect.
This commit is contained in:
parent
cfdc8030b1
commit
956d572ace
@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE GADTs, Rank2Types #-}
|
{-# LANGUAGE GADTs, KindSignatures, Rank2Types #-}
|
||||||
module Control.Abstract.Value
|
module Control.Abstract.Value
|
||||||
( AbstractValue(..)
|
( AbstractValue(..)
|
||||||
, AbstractIntro(..)
|
, 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)
|
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
|
class Show value => AbstractIntro value where
|
||||||
-- | Construct an abstract unit value.
|
-- | Construct an abstract unit value.
|
||||||
-- TODO: This might be the same as the empty tuple for some value types
|
-- TODO: This might be the same as the empty tuple for some value types
|
||||||
|
Loading…
Reference in New Issue
Block a user