Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
A type alias to Cont
for a deeply nested delimited continuation.
Examples
>>>
:set -XTypeOperators
>>>
:set -XRebindableSyntax
>>>
import Prelude hiding ((>>), (>>=), return, fail)
>>>
import Control.Dsl
>>>
import Control.Dsl.Yield
>>>
import Control.Dsl.Empty
>>>
import Control.Dsl.Monadic
>>>
:{
f :: IO () !! [Integer] !! [String] !! [Double] f = do Yield "foo" Yield 0.5 Yield "bar" Yield 42 Yield "baz" return ([] :: [Double]) :}
>>>
:{
f >>= (\d -> do { Monadic $ putStrLn $ "double list: " ++ show d ; return ([] :: [String]) }) >>= (\s -> do { Monadic $ putStrLn $ "string list: " ++ show s ; return ([] :: [Integer]) }) >>= (\i -> do { Monadic $ putStrLn $ "integer list: " ++ show i ; return () }) :} double list: [0.5] string list: ["foo","bar","baz"] integer list: [42]
A delimited continuation that can be used in a do
block.
Instances
Dsl Cont r a Source # | Statements based on monomorphic delimited continuations. |
Defined in Control.Dsl.Dsl | |
PolyCont k r a => PolyCont k (Cont r a') a Source # | The This derivated instance provide the ability similar
to |
Defined in Control.Dsl.Cont runPolyCont :: k r' a -> (a -> Cont r a') -> Cont r a' Source # | |
PolyCont Empty r Void => PolyCont Empty (Cont r a) Void Source # | |
Defined in Control.Dsl.Cont | |
PolyCont (Return r) (Cont r' r) Void Source # | |
Defined in Control.Dsl.Cont | |
PolyCont (Yield x) (Cont r [x]) () Source # | |
Defined in Control.Dsl.Yield |