Safe Haskell | None |
---|
Maybe transformer 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)
- fromMaybe :: Phi z => CodeGenFunction r (T a) -> T r z a
- toMaybe :: Undefined a => T r (T a) a -> CodeGenFunction r (T a)
- isJust :: T r (Value Bool) a -> CodeGenFunction r (Value Bool)
- lift :: CodeGenFunction r a -> T r z a
- guard :: Phi z => Value Bool -> T r z ()
- just :: a -> T r z a
- nothing :: T r z a
- bind :: T r z a -> (a -> T r z b) -> T r z b
- onFail :: CodeGenFunction r () -> T r z a -> T r z a
- alternative :: (Phi z, Undefined a) => T r (T a) a -> T r (T a) a -> T r z a
- fixedLengthLoop :: (Phi s, Undefined s, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i, CmpResult i ~ Bool) => Value i -> s -> (s -> T r (T s) s) -> CodeGenFunction r (Value i, T s)
- arrayLoop :: (Phi s, Undefined s, IsType a, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> T r (T (Value (Ptr a), s)) s) -> CodeGenFunction r (Value i, T s)
- arrayLoop2 :: (Phi s, Undefined s, IsType a, IsType b, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> T r (T (Value (Ptr a), (Value (Ptr b), s))) s) -> CodeGenFunction r (Value i, T s)
Documentation
withBool :: Phi z => Value Bool -> CodeGenFunction r a -> T r z aSource
counterpart to Data.Maybe.HT.toMaybe
onFail :: CodeGenFunction r () -> T r z a -> T r z aSource
Run an exception handler if the Maybe-action fails. The exception is propagated. That is, the handler is intended for a cleanup procedure.
alternative :: (Phi z, Undefined a) => T r (T a) a -> T r (T a) a -> T r z aSource
Run the first action and if that fails run the second action. If both actions fail, then the composed action fails, too.
fixedLengthLoop :: (Phi s, Undefined s, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i, CmpResult i ~ Bool) => Value i -> s -> (s -> T r (T s) s) -> CodeGenFunction r (Value i, T s)Source
arrayLoop :: (Phi s, Undefined s, IsType a, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> T r (T (Value (Ptr a), s)) s) -> CodeGenFunction r (Value i, T s)Source
If the returned position is smaller than the array size,
then returned final state is nothing
.
arrayLoop2 :: (Phi s, Undefined s, IsType a, IsType b, Num i, IsConst i, IsInteger i, IsFirstClass i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> T r (T (Value (Ptr a), (Value (Ptr b), s))) s) -> CodeGenFunction r (Value i, T s)Source