CCA-0.1.5.3: preprocessor and library for Causal Commutative Arrows (CCA)

Safe HaskellNone
LanguageHaskell98

Control.CCA

Synopsis

Documentation

(>>>) :: Category k cat => cat a b -> cat b c -> cat a c infixr 1

Left-to-right composition

(<<<) :: Category k cat => cat b c -> cat a b -> cat a c infixr 1

Right-to-left composition

first :: Arrow a => forall b c d. a b c -> a (b, d) (c, d)

Send the first component of the input through the argument arrow, and copy the rest unchanged to the output.

second :: Arrow a => forall b c d. a b c -> a (d, b) (d, c)

A mirror image of first.

The default definition may be overridden with a more efficient version if desired.

(***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c')

Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.

The default definition may be overridden with a more efficient version if desired.

(&&&) :: Arrow a => forall b c c'. a b c -> a b c' -> a b (c, c')

Fanout: send the input to both argument arrows and combine their output.

The default definition may be overridden with a more efficient version if desired.

loop :: ArrowLoop a => forall b d c. a (b, d) (c, d) -> a b c

class Category * a => Arrow a where

The basic arrow class.

Minimal complete definition: arr and first, satisfying the laws

where

assoc ((a,b),c) = (a,(b,c))

The other combinators have sensible default definitions, which may be overridden for efficiency.

Minimal complete definition

arr, first

Methods

first :: a b c -> a (b, d) (c, d)

Send the first component of the input through the argument arrow, and copy the rest unchanged to the output.

second :: a b c -> a (d, b) (d, c)

A mirror image of first.

The default definition may be overridden with a more efficient version if desired.

(***) :: a b c -> a b' c' -> a (b, b') (c, c') infixr 3

Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.

The default definition may be overridden with a more efficient version if desired.

(&&&) :: a b c -> a b c' -> a b (c, c') infixr 3

Fanout: send the input to both argument arrows and combine their output.

The default definition may be overridden with a more efficient version if desired.

Instances

Arrow (->) 
Arrow ASyn 
Monad m => Arrow (Kleisli m) 

class Arrow a => ArrowLoop a where

The loop operator expresses computations in which an output value is fed back as input, although the computation occurs only once. It underlies the rec value recursion construct in arrow notation. loop should satisfy the following laws:

extension
loop (arr f) = arr (\ b -> fst (fix (\ (c,d) -> f (b,d))))
left tightening
loop (first h >>> f) = h >>> loop f
right tightening
loop (f >>> first h) = loop f >>> h
sliding
loop (f >>> arr (id *** k)) = loop (arr (id *** k) >>> f)
vanishing
loop (loop f) = loop (arr unassoc >>> f >>> arr assoc)
superposing
second (loop f) = loop (arr assoc >>> second f >>> arr unassoc)

where

assoc ((a,b),c) = (a,(b,c))
unassoc (a,(b,c)) = ((a,b),c)

Methods

loop :: a (b, d) (c, d) -> a b c

Instances

ArrowLoop (->) 
ArrowLoop ASyn 
MonadFix m => ArrowLoop (Kleisli m)

Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class.

class (Arrow a, ArrowLoop a) => ArrowInit a where Source

Minimal complete definition

init

Methods

arr' :: ExpQ -> (b -> c) -> a b c Source

init' :: ExpQ -> b -> a b b Source

Instances

constant :: (ArrowInit a, Lift b) => b -> a () b Source

norm :: ASyn t t1 -> ExpQ Source

normOpt :: ASyn t t1 -> ExpQ Source