Implicit 'forall' in data declarations

Simon Peyton-Jones simonpj at
Mon Oct 25 03:16:28 EDT 2010

| On a related note, these are also apparently allowed (in 6.10.4):
|     f :: forall a. (Eq a => a -> a) -> a -> a
|    -- the Eq context prevents the function from ever being called.

That's not true.  E.g.
	f ((==) True) True
works fine.

|    g :: forall a. Ord a => (Eq a => a -> a) -> a -> a
|    -- the Eq context is effectively ignored

That's a bit more true, because Ord a implies Eq a, but still not really.  It still says that you must pass evidence for equality to g's argument.


More information about the Glasgow-haskell-users mailing list