inject-function-0.2.0.0: Monadic functions with injected parameters.

Safe HaskellSafe-Inferred

Control.InjFun

Contents

Synopsis

Inject function

data InjFun c i m o Source

Function able to be injected parameters in. c is the injected control parameters, i represents its input, m is the resulting monad and o is the output.

cfapply :: InjFun c i m o -> c -> i -> m oSource

Feed a InjFun with its regular parameters and injected parameters.

inject :: (c -> i -> m o) -> InjFun c i m oSource

Create an inject function.

Sequencing, exploding and merging

(|->)Source

Arguments

:: Monad m 
=> InjFun c i m o

First function

-> InjFun c o m o'

Second function

-> InjFun c i m o'

Resulting sequencing function

Sequencing operator. It’s a helper function that composes with >>= the two InjFun, respecting the order. That version (with a single `|`) means that both the two injected parameters are considered the same; then they’re shared as a single c.

(||->)Source

Arguments

:: Monad m 
=> InjFun c i m o

First function

-> InjFun c' o m o'

Second function

-> InjFun (c, c') i m o'

Resulting sequencing function

Sequencing operator. It’s a helper function that composes with >>= the two InjFun, respecting the order. That version (with double `|`) means that the two injected parameters are considered different.

explodeSource

Arguments

:: Monad m 
=> InjFun c i m (o0, o1)

Function to explode

-> (InjFun c i m o0, InjFun c i m o1)

Exploded functions

Explode an InjFun that outputs two values into two other InjFun.

mergeSource

Arguments

:: Monad m 
=> InjFun c i m o

First function

-> InjFun c' i' m o'

Second function

-> InjFun (c, c') (i, i') m (o, o')

Merged function

Merge two InjFun into one.