1 -----------------------------------------------------------------------------
3 -- Module : Control.Category
4 -- Copyright : (c) Ashley Yakeley 2007
5 -- License : BSD-style (see the LICENSE file in the distribution)
7 -- Maintainer : ashley@semantic.org
8 -- Stability : experimental
9 -- Portability : portable
11 -- http://hackage.haskell.org/trac/ghc/ticket/1773
13 module Control.Category where
15 import qualified Prelude
20 -- | A class for categories.
21 -- id and (.) must form a monoid.
22 class Category cat where
23 -- | the identity morphism
26 -- | morphism composition
27 (.) :: cat b c -> cat a b -> cat a c
30 "identity/left" forall p .
32 "identity/right" forall p .
34 "association" forall p q r .
35 (p . q) . r = p . (q . r)
38 instance Category (->) where
41 -- Haddock 1.x cannot parse this:
45 -- | Right-to-left composition
46 (<<<) :: Category cat => cat b c -> cat a b -> cat a c
49 -- | Left-to-right composition
50 (>>>) :: Category cat => cat a b -> cat b c -> cat a c