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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe