Maybe datatype implemented in continuation passing style.
- newtype T r z a = Cons {
- resolve :: CodeGenFunction r z -> (a -> CodeGenFunction r z) -> CodeGenFunction r z
- map :: (a -> CodeGenFunction r b) -> T r z a -> T r z b
- withBool :: Phi z => Value Bool -> CodeGenFunction r a -> T r z a
- fromBool :: Phi z => CodeGenFunction r (Value Bool, a) -> T r z a
- toBool :: Undefined a => T r (Value Bool, a) a -> CodeGenFunction r (Value Bool, a)
- lift :: CodeGenFunction r a -> T r z a
- guard :: Phi z => Value Bool -> T r z ()
- bind :: T r z a -> (a -> T r z b) -> T r z b
- arrayLoop :: (Phi s, IsType a, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i Bool) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> T r (Value Bool, s) s) -> CodeGenFunction r (Value i, s)
- arrayLoop2 :: (Phi s, IsType a, IsType b, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i Bool) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> T r (Value Bool, (Value (Ptr b), s)) s) -> CodeGenFunction r (Value i, s)
Documentation
Isomorphic to ReaderT (CodeGenFunction r z) (ContT z (CodeGenFunction r)) a
,
where the reader provides the block for Nothing
and the continuation part manages the Just
.
Cons | |
|
map :: (a -> CodeGenFunction r b) -> T r z a -> T r z bSource
withBool :: Phi z => Value Bool -> CodeGenFunction r a -> T r z aSource
counterpart to Data.Maybe.HT.toMaybe
lift :: CodeGenFunction r a -> T r z aSource
arrayLoop :: (Phi s, IsType a, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i Bool) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> T r (Value Bool, s) s) -> CodeGenFunction r (Value i, s)Source
If the returned position is smaller than the array size, then returned final state is undefined.