
7 Dec
2001
7 Dec
'01
10:13 a.m.
| Yes, GHC will common these up (with -O). I'm not sure | I understand the point about the type checker not | letting you do this yourself, though: surely x and | (a:as) have the same type? In the following definition, one is not allowed to: instance Functor (Either a) where fmap f (Left a) = Left a fmap f (Right b) = Right (f b) The first line cannot be written as: fmap f x@(Left a) = x Because it does not type check! /Koen.