Copyright | (c) Paweł Nowak |
---|---|
License | MIT |
Maintainer | Paweł Nowak <[email protected]> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Control.Category.Structures
Description
This module defines some basic structures in a category in a more fine-grained way then Control.Arrow.
Unfortunately names in this module clash with Control.Arrow.
Documentation
class Category cat => Products cat where Source
A category with finite products.
Methods
first :: cat a b -> cat (a, c) (b, c) Source
Send the first component of the input through the argument arrow, and copy the rest unchanged to the output.
first a
is equal to a *** id
.
second :: cat a b -> cat (c, a) (c, b) Source
A mirror image of first
.
second a
is equal to id *** a
.
(***) :: cat a b -> cat c d -> cat (a, c) (b, d) infixl 3 Source
A product of two arrows. Split the input between the two argument arrows and combine their output.
class Category cat => Coproducts cat where Source
A category with finite coproducts.
Methods
left :: cat a b -> cat (Either a c) (Either b c) Source
Feed marked inputs through the argument arrow, passing the rest through unchanged to the output.
left a
is equal to a +++ id
.
right :: cat a b -> cat (Either c a) (Either c b) Source
A mirror image of left.
right a
is equal to id +++ a
.
(+++) :: cat a b -> cat c d -> cat (Either a c) (Either b d) infixl 2 Source
A coproduct of two arrows. Split the input between the two argument arrows, retagging and merging their outputs.
Instances
Coproducts (->) | |
Coproducts ReifiedSemiIso' | |
Monad m => Coproducts (Kleisli m) | |
Coproducts cat => Coproducts (Dual cat) | |
Coproducts cat => Coproducts (ReaderCT env cat) |