Implicit 'forall' in data declarations

David Menendez dave at
Fri Oct 22 12:27:10 EDT 2010

On Fri, Oct 22, 2010 at 4:20 AM, Simon Peyton-Jones
<simonpj at> wrote:
> Does anyone listening to this thread have an opinion?  Just to summarise, Sebastian's
> proposal is that Haskell's implicit quantification (adding foralls) would occur *only* right
> at the top of a  type signature.

Before this discussion, I thought things already worked the way you
describe in your proposal.

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.

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

Up until now, I thought contexts were only allowed after a forall
(explicit or implicit), and I can't really think of a reason to have
one anywhere else.

My suggestion would be either
(1) forbid contexts, except after foralls, and only implicitly add
foralls at the top of the type
(2) add implicit foralls before any context, even if the variables are
already in scope

Dave Menendez <dave at>

More information about the Glasgow-haskell-users mailing list