3 -----------------------------------------------------------------------------
5 -- Module : Control.Category
6 -- Copyright : (c) Ashley Yakeley 2007
7 -- License : BSD-style (see the LICENSE file in the distribution)
9 -- Maintainer : ashley@semantic.org
10 -- Stability : experimental
11 -- Portability : portable
13 -- http://hackage.haskell.org/trac/ghc/ticket/1773
15 module Control.Category where
17 import qualified Prelude
22 -- | A class for categories.
23 -- id and (.) must form a monoid.
24 class Category cat where
25 -- | the identity morphism
28 -- | morphism composition
29 (.) :: cat b c -> cat a b -> cat a c
32 "identity/left" forall p .
34 "identity/right" forall p .
36 "association" forall p q r .
37 (p . q) . r = p . (q . r)
40 instance Category (->) where
43 -- Haddock 1.x cannot parse this:
47 -- | Right-to-left composition
48 (<<<) :: Category cat => cat b c -> cat a b -> cat a c
51 -- | Left-to-right composition
52 (>>>) :: Category cat => cat a b -> cat b c -> cat a c