Safe Haskell | None |
---|---|

Language | Haskell2010 |

- type Arr r a b = a -> Eff r b
- type Arrs r a b = FTCQueue (Eff r) a b
- data Eff r a where
- qApp :: Arrs r b w -> b -> Eff r w
- qComp :: Arrs r a b -> (Eff r b -> Eff r' c) -> Arr r' a c
- qComps :: Arrs r a b -> (Eff r b -> Eff r' c) -> Arrs r' a c
- send :: Member t r => t v -> Eff r v
- run :: Eff '[] w -> w
- type Handler t r w = forall v. t v -> Arr r v w -> Eff r w
- type HandlerS s t r w = forall v. s -> t v -> (s -> Arr r v w) -> Eff r w
- handleRelay :: (a -> Eff r w) -> Handler t r w -> Eff (t ': r) a -> Eff r w
- handleRelayS :: s -> (s -> a -> Eff r w) -> HandlerS s t r w -> Eff (t ': r) a -> Eff r w
- interpose :: Member t r => (a -> Eff r w) -> (forall v. t v -> Arr r v w -> Eff r w) -> Eff r a -> Eff r w

# Documentation

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

type Arrs r a b = FTCQueue (Eff r) a b Source #

An effectful function from `a`

to `b`

that is a composition
of several effectful functions. The paremeter r describes the overall
effect.
The composition members are accumulated in a type-aligned queue

The Eff monad (not a transformer!) It is a fairly standard coroutine monad It is NOT a Free monad! There are no Functor constraints Status of a coroutine (client): done with the value of type w, or sending a request of type Union r with the continuation Arrs r b a. Potentially, inline Union into Impure

qApp :: Arrs r b w -> b -> Eff r w Source #

Application to the `generalized effectful function' Arrs r b w

qComp :: Arrs r a b -> (Eff r b -> Eff r' c) -> Arr r' a c Source #

Compose effectful arrows (and possibly change the effect!)

type HandlerS s t r w = forall v. s -> t v -> (s -> Arr r v w) -> Eff r w Source #

Parameterized Handler type

handleRelay :: (a -> Eff r w) -> Handler t r w -> Eff (t ': r) a -> Eff r w Source #

A convenient pattern: given a request (open union), either handle it or relay it.