freer-effects-0.3.0.1: Implementation of effect system for Haskell.

Copyright(c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.
LicenseBSD3
Maintainerixcom-core@ixperta.com
Stabilitybroken
PortabilityGHC specific language extensions.
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Freer.Coroutine

Description

An effect to compose functions with the ability to yield.

Using http://okmij.org/ftp/Haskell/extensible/Eff1.hs as a starting point.

Synopsis

Documentation

data Yield a b c Source #

A type representing a yielding of control.

Type variables have following meaning:

a
The current type.
b
The input to the continuation function.
c
The output of the continuation.

Constructors

Yield a (b -> c) 

Instances

Functor (Yield a b) Source # 

Methods

fmap :: (a -> b) -> Yield a b a -> Yield a b b #

(<$) :: a -> Yield a b b -> Yield a b a #

yield :: Member (Yield a b) effs => a -> (b -> c) -> Eff effs c Source #

Lifts a value and a function into the Coroutine effect.

data Status effs a b Source #

Represents status of a coroutine.

Constructors

Done

Coroutine is done.

Continue a (b -> Eff effs (Status effs a b))

Reporting a value of the type a, and resuming with the value of type b.

runC :: Eff (Yield a b ': effs) w -> Eff effs (Status effs a b) Source #

Launch a coroutine and report its status.