Copyright | Allele Dev 2016 |
---|---|

License | BSD-3 |

Maintainer | allele.dev@gmail.com |

Stability | experimental |

Portability | POSIX |

Safe Haskell | None |

Language | Haskell2010 |

- class Member' t r (FindElem t r) => Member t r
- type family Members m r :: Constraint where ...
- data Eff r a
- run :: Eff '[] w -> w
- runM :: Monad m => Eff '[m] w -> m w
- runNat :: forall m r e w. Member m r => (forall a. e a -> m a) -> Eff (e ': r) w -> Eff r w
- handleRelay :: (a -> Eff r w) -> (forall v. t v -> Arr r v w -> Eff r w) -> Eff (t ': r) a -> Eff r w
- handleRelayS :: s -> (s -> a -> Eff r w) -> (forall v. s -> t v -> (s -> Arr r v w) -> Eff r w) -> Eff (t ': r) a -> Eff r w
- send :: Member t r => t v -> Eff r v
- type Arr r a b = a -> Eff r b
- data NonDetEff a where
- makeChoiceA :: Alternative f => Eff (NonDetEff ': r) a -> Eff r (f a)
- msplit :: Member NonDetEff r => Eff r a -> Eff r (Maybe (a, Eff r a))

# Documentation

type family Members m r :: Constraint where ... Source #

The Eff representation.

Status of a coroutine (client): * Val: Done with the value of type a * E : Sending a request of type Union r with the continuation Arrs r b a

run :: Eff '[] w -> w Source #

Runs a set of Effects. Requires that all effects are consumed. Typically composed as follows: > run . runEff1 eff1Arg . runEff2 eff2Arg1 eff2Arg2 (program)

runM :: Monad m => Eff '[m] w -> m w Source #

Runs a set of Effects. Requires that all effects are consumed, except for a single effect known to be a monad. The value returned is a computation in that monad. This is useful for plugging in traditional transformer stacks.

runNat :: forall m r e w. Member m r => (forall a. e a -> m a) -> Eff (e ': r) w -> Eff r w Source #

handleRelay :: (a -> Eff r w) -> (forall v. t v -> Arr r v w -> Eff r w) -> Eff (t ': r) a -> Eff r w Source #

Given a request, either handle it or relay it.

handleRelayS :: s -> (s -> a -> Eff r w) -> (forall v. s -> t v -> (s -> Arr r v w) -> Eff r w) -> Eff (t ': r) a -> Eff r w Source #

Parameterized `handleRelay`

Allows sending along some state to be handled for the target
effect, or relayed to a handler that can handle the target effect.

type Arr r a b = a -> Eff r b Source #

Effectful arrow type: a function from a to b that also does effects denoted by r

makeChoiceA :: Alternative f => Eff (NonDetEff ': r) a -> Eff r (f a) Source #

A handler for nondeterminstic effects