
11 Jan
2007
11 Jan
'07
10:14 a.m.
2007/1/11, Marco TĂșlio Gontijo e Silva
Hello,
is there a way to defined something as a map to use in tuples? I tried this:
mapTuple f (a, b) = (f a, f b)
But the type inferred to it is not as generic as I wanted:
mapTuple :: (t -> t1) -> (t, t) -> (t1, t1)
Then I tried a different, but not much, implementation:
mapTuple' f g (a, b) = (f a, g b) mapTuple f = mapTuple' f f
But the inferred type was the same.
Is there a way to define a function in which I can be able to do something as this?
mapTuple show ("string", True)
Hi, you might want invistigate "heterogeneous lists" : in your case, it's "heterogeneous typle". There's a page lying on the wiki I think... It involves typeclasses and type quantifiers. Ciao, minh thu