in-other-words-0.1.0.0: A higher-order effect system where the sky's the limit

Synopsis

# Effects

data Ask i m a where Source #

An effect for arbitrary input

Constructors

data Local i m a where Source #

An effect for locally modifying an environment used to gain access to information.

Constructors

 Local :: (i -> i) -> m a -> Local i m a

A pseudo-effect for connected Ask i and Local i effects.

Reader should only ever be used inside of Eff and Effs constraints. It is not a real effect! See Bundle.

# Actions

asks :: Eff (Ask i) m => (i -> a) -> m a Source #

local :: Eff (Local i) m => (i -> i) -> m a -> m a Source #

# Interpretations

runAskConst :: forall i m a. Carrier m => i -> InterpretReifiedC (Ask i) m a -> m a Source #

Run an Ask effect by providing a constant to be given at each use of ask.

This has a higher-rank type, as it makes use of InterpretReifiedC. This makes runAskConst very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower runAskConstSimple, which doesn't have a higher-rank type.

runAskAction :: forall i m a. Carrier m => m i -> InterpretReifiedC (Ask i) m a -> m a Source #

Run an Ask effect by providing an action to be executed at each use of ask.

This has a higher-rank type, as it makes use of InterpretReifiedC. This makes runAskAction very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower runAskActionSimple, which doesn't have a higher-rank type.

askToAsk :: forall i j m a. Eff (Ask j) m => (j -> i) -> InterpretReifiedC (Ask i) m a -> m a Source #

Transform an Ask i effect into an Ask j effect by providing a function to convert j to i.

This has a higher-rank type, as it makes use of InterpretReifiedC. This makes askToAsk very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower askToAskSimple, which doesn't have a higher-rank type.

Run connected Ask i and Local i effects -- i.e. Reader i.

Derivs (ReaderC i m) = Local i ': Ask i ': Derivs m
Prims  (ReaderC i m) = ReaderPrim i ': Prims m

# Simple variants

Run an Ask effect by providing a constant to be given at each use of ask

This is a less performant version of runAskConst that doesn't have a higher-rank type, making it much easier to use partially applied.

Run an Ask effect by providing an action to be executed at each use of ask.

This is a less performant version of runAskAction that doesn't have a higher-rank type, making it much easier to use partially applied.

Transform an Ask i effect into an Ask j effect by providing a function to convert j to i.

This is a less performant version of askToAsk that doesn't have a higher-rank type, making it much easier to use partially applied.

The most common threading constraint of the library, as it is emitted by -Simple interpreters (interpreters that internally make use of interpretSimple or reinterpretSimple).

ReaderThreads accepts all the primitive effects (intended to be used as such) offered in this library.

Most notably, ReaderThreads accepts Unlift b.

#### Instances

Instances details