control-dsl-0.2.0.1: An alternative to monads

Safe HaskellSafe
LanguageHaskell2010

Control.Dsl.Cont

Synopsis

Documentation

type (!!) = Cont Source #

A type alias to Cont for a deeply nested delimited continuation.

Examples

Expand
>>> :set -XTypeOperators
>>> :set -XRebindableSyntax
>>> import Prelude hiding ((>>), (>>=), return, fail)
>>> import Control.Dsl
>>> import Control.Dsl.Yield
>>> import Control.Dsl.Empty
>>> :{
f :: IO () !! [Integer] !! [String] !! [Double]
f = do
  Yield "foo"
  Yield 0.5
  Yield 42
  empty
:}

newtype Cont r a Source #

Constructors

Cont 

Fields

Instances
Dsl Cont r a Source #

Statements based on monomorphic delimited continuations.

Instance details

Defined in Control.Dsl.Dsl

Methods

cpsApply :: Cont r a -> (a -> r) -> r

PolyCont k r a => PolyCont k (Cont r a') a Source # 
Instance details

Defined in Control.Dsl.Cont

Methods

runPolyCont :: k r' a -> (a -> Cont r a') -> Cont r a' Source #

PolyCont Empty r Void => PolyCont Empty (Cont r a) Void Source # 
Instance details

Defined in Control.Dsl.Cont

Methods

runPolyCont :: Empty r' Void -> (Void -> Cont r a) -> Cont r a Source #

PolyCont (Return r) (Cont r' r) Void Source # 
Instance details

Defined in Control.Dsl.Cont

Methods

runPolyCont :: Return r r'0 Void -> (Void -> Cont r' r) -> Cont r' r Source #

PolyCont (Yield x) (Cont r [x]) () Source # 
Instance details

Defined in Control.Dsl.Yield

Methods

runPolyCont :: Yield x r' () -> (() -> Cont r [x]) -> Cont r [x] Source #

when :: Bool -> Cont r () -> Cont r () Source #

unless :: Bool -> Cont r () -> Cont r () Source #