control-dsl-0.2.1.3: An alternative to monads for control flow DSLs

Safe HaskellSafe
LanguageHaskell2010

Control.Dsl.PolyCont

Synopsis

Documentation

class PolyCont k r a where Source #

A use case of an ad-hoc polymorphic delimited continuation.

Note that a PolyCont is not a polymorphic delimited continuation, since a PolyCont does not support answer type modification.

Minimal complete definition

runPolyCont

Methods

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

Run as a CPS function .

Instances
Alternative m => PolyCont Empty (m a) Void Source # 
Instance details

Defined in Control.Dsl.Empty

Methods

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

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

The PolyCont derivation rule for any keywords in a Cont do block.

This derivated instance provide the ability similar to ContT monad transformers.

Instance details

Defined in Control.Dsl.Cont

Methods

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

PolyCont k r Void => PolyCont k (State s r) Void Source # 
Instance details

Defined in Control.Dsl.State.State

Methods

runPolyCont :: k r' Void -> (Void -> State s r) -> State s r Source #

PolyCont k r a => PolyCont k (State s r) a Source #

The PolyCont derivation rule for any keywords in a State do block.

This derivated instance provide the ability similar to StateT or ReaterT monad transformers.

Instance details

Defined in Control.Dsl.State.State

Methods

runPolyCont :: k r' a -> (a -> State s r) -> State s r 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 Empty r Void => PolyCont Empty (State s r) Void Source # 
Instance details

Defined in Control.Dsl.State.State

Methods

runPolyCont :: Empty r' Void -> (Void -> State s r) -> State s r Source #

PolyCont Get (State s r) s Source # 
Instance details

Defined in Control.Dsl.State.Get

Methods

runPolyCont :: Get r' s -> (s -> State s r) -> State s r Source #

PolyCont (Return r) r Void Source # 
Instance details

Defined in Control.Dsl.Return

Methods

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

PolyCont (Shift r) r a Source # 
Instance details

Defined in Control.Dsl.Shift

Methods

runPolyCont :: Shift r r' a -> (a -> r) -> r Source #

Monad m => PolyCont (Monadic m) (m b) a Source # 
Instance details

Defined in Control.Dsl.Monadic

Methods

runPolyCont :: Monadic m r' a -> (a -> m b) -> m b Source #

Applicative m => PolyCont (Return r) (m r) Void Source # 
Instance details

Defined in Control.Dsl.Return

Methods

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

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

Defined in Control.Dsl.Yield

Methods

runPolyCont :: Yield x r' () -> (() -> [x]) -> [x] 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 (Return r) (State s r) Void Source # 
Instance details

Defined in Control.Dsl.State.State

Methods

runPolyCont :: Return r r' Void -> (Void -> State s r) -> State s r Source #

PolyCont (Put s) (State s r) () Source # 
Instance details

Defined in Control.Dsl.State.Put

Methods

runPolyCont :: Put s r' () -> (() -> State s r) -> State s 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 #