Proposal: Add Compositor class as superclass of Arrow

apfelmus apfelmus at quantentunnel.de
Sat Oct 13 05:08:57 EDT 2007


Ashley Yakeley wrote:
> http://hackage.haskell.org/trac/ghc/ticket/1773
> (darcs patch attached to ticket)
> 
> The Compositor class has two members:
> 
>  class Compositor comp where
>    identity :: comp a a
>    (>>>) :: comp a b -> comp b c -> comp a c
> 
> with the obvious monoid. Since all Arrows are Compositors, make 

Yes, bring 'em in! But _only_ under their standard name :)

   class Category c where
     id  :: c a a
     (.) :: c b c -> c a b -> c a c

subject to the well-known laws

    f = id . f = f . id
    f . (g . h) = (f . g) . h

Who says category theory isn't for functional programmers? ;)

Unfortunately, the names  id  and (.) are already taken / give headache 
to those that don't like  map :: Functor f => (a -> b) -> f a -> f b .

Regards,
apfelmus



More information about the Libraries mailing list