
19 Jan
2009
19 Jan
'09
1:49 p.m.
Am Montag, den 19.01.2009, 14:47 +0100 schrieb Daniel Fischer:
Am Montag, 19. Januar 2009 14:31 schrieb Antoine Latter:
2009/1/19 Luke Palmer
: As a side curiosity, I would love to see an example of any data structure which has more than one Functor instance. Especially those which have more than one useful functor instance.
(,) ?
-Antoine
Wrong kind. And (,) a has only one useful instance.
What about instance Functor ((,) a) where fmap f (x,y) = (x, f y) and instance Functor (, a) where fmap f (x, y) = (f x, y) ? Of course, the latter is not legal Haskell. But if it was, then it might be useful. Is there any way to declare this Functor instance, possibly with some GHC extensions?