
24 Feb
2016
24 Feb
'16
8:42 p.m.
1. An explanation of a monoid as a category with exactly one object newtype Cat c a = Cat {getCat :: c a a} instance Category c => Monoid (c a) newtype Mon m a b = Mon {getMon :: m} instance Monoid m => Category (Mon m) --This would be more precisely written -- data Mon m a b where -- Mon :: m -> Mon a a -- but that hurts performance without seeming to offer much in return 2. newtype Op c a b = Op {getOp :: c b a} instance Category c => Category (Op c) instance Bifunctor c => Bifunctor (Op c) instance Bifunctor c => Functor (Op c a) instance Profunctor c => Contravariant (Op c a) I see that Control.Category.Dual in the categories package offers a version of this last defined as *data* for some reason.