
On 2007-07-13, Jules Bean
Andrew Coppin wrote:
Lukas Mai wrote:
Am Donnerstag, 12. Juli 2007 20:14 schrieb Andrew Coppin:
The only thing the libraries provide, as far as I can tell, is the fact that tuples are all Functors. (In other words, you can apply some function to all the elements to get a new tuple.) I think that's about it. I doubt you can use that to define lifting functions...
Actually, they aren't (Functors).
Oh. Kay... well that makes me look *very* intelligent. :-}
(,) takes two type arguments, (,,) takes three, etc. class Functor f requires f to take one type argument.
Ah. A kind error. Yes, you're right about that... oops.
nah, you do yourself an injustice, Andrew.
(a,b) is certainly functorial, in both a, and in b. I.e. (,b) is a functor "in the a component", and so is (a,) "in the b component".
Furthermore (a,a) is also functorial: it's just "lists of exactly length two" and we know lists are functorial.
It is a deficiency of the haskell class system (although I'm not trying to claim it's a particularly important one in practice) that it's not really possible to express all these things at once.
It's a deficiency of all OO systems as well. Nothing handles well the case of a structure being usable as a certain type of object two different ways. It's most recognized there as the "multiple inheritance problem", where the same interface (or base class) is inherited twice from different paths, but the problem is deeper than that. -- Aaron Denney -><-