Scoped type variables
simonpj at microsoft.com
Mon Dec 20 03:37:21 EST 2004
| Would it help to stick the quantifier at the beginning of
| the type declaration?
| > forall a b . g :: Foo a b => [a] -> [a]
| > g = ...
Since GHC already allows explicit quantifiers, I had indeed wondered
about saying that a type sig only brings type variables into scope if it
has an explicit quantifier. Thus
g :: forall a b. Foo a b => [a] -> [a]
g = ...
would bring a & b into scope in the "...", but
g :: Foo a b => [a] -> [a]
g = ...
would not. I guess that has the merit that adding the feature would
break fewer programs.
I'm not keen on putting the foralls before the function name.
More information about the Glasgow-haskell-users