Further to discussion on the StdHask site, and (of all places) ghc-bugs,
I remain concerned about the program-breaking proposal to have typesigs
scope over equation groups, thereby binding any type variable occurrences
in local signatures. But I agree with the need to add this expressivity.
Surely it's possible to do this by a purely conservative extension, though?
One idea that springs to mind is to indeed extend the scope of signatures
in this way, _but_ that local signatures still introduce fresh t.v.'s,
unless explicitly notated otherwise. (Leaving only the question of
what a suitable notation would be...)
At the risk of inducing mild nausea, I can think of some possible
syntax for this (though I'm sure there will be better suggestions:
> f :: [a] -> a -> [a]
> f (x:xs) y = g y
> where
> g :: a -> [a]
> g q = [x,q]
Instead of the local siggie:
g :: a -> [a]
being given a "monomorphised" interpretations, why not use, say:
g :: f.a -> [f.a]
g :: monotype a => a -> [a]
g :: scoped a => a -> [a]
OK, maybe not pretty, but it'd do the job, no?
Slainte,
Alex.