Proposal: Add Compositor class as superclass of Arrow
Ashley Yakeley
ashley at semantic.org
Sat Oct 13 15:34:35 EDT 2007
apfelmus wrote:
> 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
class Category cat where
id :: cat a a
(.) :: cat b c -> cat a b -> cat a c
I'm not against this, but it would mean moving Category to the Prelude.
As far as bikeshed issues:
1. I don't care either way about the name. "Category" or "Morphism"
would both be fine.
2. I made a sort of "minimal bikeshed" patch, with this from Arrow:
(>>>) :: comp a b -> comp b c -> comp a c
But I actually prefer
(<<<) :: comp b c -> comp a b -> comp a c
, like (.). I originally called that member 'compose'.
> 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 .
I prefer the generalised 'map' too. In fact I always use fmap over
lists, map is just one more thing to remember so I don't. But that's
another proposal...
--
Ashley Yakeley
Seattle, WA
More information about the Libraries
mailing list