Implicit 'forall' in data declarations

Sebastian Fischer fischer at nii.ac.jp
Thu Oct 21 21:03:50 EDT 2010


On Oct 21, 2010, at 9:58 PM, Simon Peyton-Jones wrote:

> So GHC's behaviour is probably about right, but the description is  
> wrong.

On Oct 21, 2010, at 11:14 PM, Sebastian Fischer wrote:

>    An implicit quantification point is
>      a) the type in a type signature f :: type or
>      b) a type of the form (context => type)
>    if it does not start with an explicit 'forall'

I have mixed feelings about b). A special treatment of contexts is  
convenient but also confusing because they are treated differently  
depending on where they occur.

It is convenient because one can omit 'forall's in higher-rank types  
if they use contexts. It is confusing because types with context in  
type signatures are treated differently than types with context in  
data declarations (because type signatures are implicit quantification  
points and arguments in data declarations are not.)

How inconvenient would it be to make the above description simpler by  
dropping b) and thus require more explicit 'forall's? I don't know  
what I prefer. I like both convenience and simplicity of explanations  
and cannot judge wich alternative has more convincing arguments in  
this case.

Sebastian


More information about the Glasgow-haskell-users mailing list