|Version 1 (modified by john@…, 9 years ago) (diff)|
In haskell 98 type expressions, all free variables are collected and treated as if there was an implicit 'forall <ts..> .' in front of the type. This makes certain extensions to the type system such as rank n types and scoped type variables tricky to deal with while maintaining backwards compatability.
Require explicit quantification on all expression bound type sigatures as in.
foo = (id :: forall a . a -> a) 'x'
if this were required it would get rid of a whole class of errors dealing with name capture of a scoped type variable. Even if scoped type variables are not in the standard, following this rule would make it much easier on implementations that do have them since it would mean that vaild haskell' programs could not become invalid when scoped type variables are turned on. Although this is not backwards compatable, the issue comes up rarely, is easy to fix, and would produce an informative error message in most cases during the transition.
more drastic proposal
require explicit quantification everywhere. The main argument for this is consistancy. No type variables are in scope in a let bound type signature so which variables should be quantified is unambiguous.