David Menendez wrote:


instance Functor ((,) a) where
fmap f (x,y) = (x, f y)



If we get rid of '(,)' and redefine '(a,b)' as sugar for 'TCons a (TCons
b HNil)' (or whatever), then there is no way to declare the above instance. I don't think that's a deal-killer, but it is a disadvantage.



You need to swap the arguments to TCons...

data TCons l a = TCons !l a

Then:

instance Functor (TCons (TCons HNil a)) where
   fmap f (TCons (TCons HNil x) y) = TCons (TCons HNil (f x)) y)

   Keean.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to