inject-function-0.2.1.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.

Exploding and merging

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 c0 i0 m o0

First function

-> InjFun c1 i1 m o1

Second function

-> InjFun (c0, c1) (i0, i1) m (o0, o1)

Merged function

Merge two InjFun into one.

Combinators

(||->)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.

(|->)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 (o0, o1)

Function to explode

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

Functions to feed

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

Exploded and fed functions

Explode an InjFun and feed two other ones with exploded parts of it.

In that version, each of the three functions has its own inject parameter.

(-<|)Source

Arguments

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

Function to explode

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

Functions to feed

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

Exploded and fed functions

Explode an InjFun and feed two other ones with exploded parts of it.

In that version, all the three functions share the same inject parameter.

(>-)Source

Arguments

:: Monad m 
=> (InjFun c0 i0 m o0, InjFun c1 i1 m o1)

Functions to merge

-> InjFun c2 (o0, o1) m o'

Function to feed

-> InjFun (c0, c1, c2) (i0, i1) m o'

Merged and fed function

Merge two InjFun and feed another one with the merged function.

In that version, each of the three functions has it its own inject parameter.

(>-|)Source

Arguments

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

Functions to merge

-> InjFun c (o0, o1) m o'

Function to feed

-> InjFun c (i0, i1) m o'

Merged and fed function

Merge two InjFun and feed another one with the merged function.

In that version, all the three functions share the same inject parameter.