X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FCategory.hs;h=b63fc67c92ed3d86a5680134f1471102567eab25;hb=8bb6db3e726aa1eeb6d512bfb5165f9f9f92210c;hp=13fba06aa33da516d7115b30e36caae5bcaaf62b;hpb=f794b53658a22a1464db7168f9821c194bcf5268;p=ghc-base.git diff --git a/Control/Category.hs b/Control/Category.hs index 13fba06..b63fc67 100644 --- a/Control/Category.hs +++ b/Control/Category.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP #-} + ----------------------------------------------------------------------------- -- | -- Module : Control.Category @@ -12,7 +14,6 @@ module Control.Category where -import Prelude hiding (id,(.)) import qualified Prelude infixr 9 . @@ -21,24 +22,27 @@ infixr 1 >>>, <<< -- | A class for categories. -- id and (.) must form a monoid. class Category cat where - -- | the identity morphism - id :: cat a a + -- | the identity morphism + id :: cat a a - -- | morphism composition - (.) :: cat b c -> cat a b -> cat a c + -- | morphism composition + (.) :: cat b c -> cat a b -> cat a c {-# RULES -"identity/left" forall p . - id . p = p -"identity/right" forall p . - p . id = p -"association" forall p q r . - (p . q) . r = p . (q . r) +"identity/left" forall p . + id . p = p +"identity/right" forall p . + p . id = p +"association" forall p q r . + (p . q) . r = p . (q . r) #-} instance Category (->) where - id = Prelude.id - (.) = (Prelude..) + id = Prelude.id +#ifndef __HADDOCK__ +-- Haddock 1.x cannot parse this: + (.) = (Prelude..) +#endif -- | Right-to-left composition (<<<) :: Category cat => cat b c -> cat a b -> cat a c