[Haskell-cafe] Is there a nice place for extra stuff for Category?
David Feuer
david.feuer at gmail.com
Thu Feb 25 01:42:27 UTC 2016
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160224/39066162/attachment.html>
More information about the Haskell-Cafe
mailing list