[Haskell-cafe] Product-Categories
Lyndon Maydwell
maydwell at gmail.com
Thu Jul 4 03:19:34 CEST 2013
Hi Café.
I'm wracking my brain trying to figure out a simple, reasonably general,
implementation for a category instance for pairs of categories.
So far I've looked at [1], which seems great, but doesn't use the built-in
category instance, and [2], which I'm just not sure about.
Ideally I'd like to be able to express something like -
instance (Category a, Category b) => Category (Product a b) where
id = Product id id
Product o1 o2 . Product i1 i2 = Product (o1 . i1) (o2 . i2)
However, it all falls apart when I actually try to define anything. Is this
possible? If not, why not?
As far as I can tell the issue boils down to not being able to translate
"Category i o" to "Product (Fst i) (Fst o) (Snd i) (Snd o)" without
breaking the kind expectation of the category instance.
Please help me, I'm having a bad brain day :-)
[1] - http://twanvl.nl/blog/haskell/categories-over-pairs-of-types
[2] -
http://hackage.haskell.org/packages/archive/categories/1.0.6/doc/html/Control-Category-Cartesian.html#t:Product
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130704/6e0002ee/attachment.htm>
More information about the Haskell-Cafe
mailing list