| 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.


_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to