Proposal: Add Compositor class as superclass of Arrow
Twan van Laarhoven
twanvl at gmail.com
Mon Oct 22 19:27:14 EDT 2007
Bertram Felgenhauer wrote:
> This is a rather finely grained hierarchy, but it's still too coarse
> to define a category of invertible functions. That category has pairs:
> it supports first, second and (***), but not fst and snd.
You are right, That would suggest
class Category cat => CategoryPair cat where
swap :: cat (a,b) (b,a)
first :: cat a b -> cat (a,c) (b,c)
second :: cat a b -> cat (c,a) (c,b)
(***) :: cat a b -> cat c d -> cat (a,c) (b,d)
class CategoryPair cat => CategorySelect cat where
fst :: cat (a,b) a
snd :: cat (a,b) b
And dually
class Category cat => CategoryChoice cat where
mirror :: cat (Either a b) (Either b a)
left :: cat a b -> cat (Either a c) (Either b c)
right :: cat a b -> cat (Either c a) (Either c b)
(+++) :: cat a b -> cat c d -> cat (Either a c) (Either b d)
class CategoryChoice cat => CategoryInject cat where
inl :: cat a (Either a b)
inr :: cat b (Either a b)
Twan
More information about the Libraries
mailing list