Re: [Haskell] Lexically scoped type variables

Hello Simon, Wednesday, October 18, 2006, 12:09:40 PM, you wrote:
Other alternatives would be: do something about partial type signatures; or make GADT type inference more sophisticated (and thereby perhaps less predicatable).
just one more problem is that this issue is too complicated. i'm not sure that i correctly understands details, but for me the situation seems like this: in 6.4 it was no distinction between declarations and usages of type variables - first use declared it, while in 6.6 we have exactly defined places to declare type variable. the problem is that sometimes we want to declare variable for one type but the place where it may be declared - function signature - requires to write full type so, if my understanding is correct, may be it's possible to use special syntax for explicit _declaration_ of type variable at any place where it can be used? i mean the following: f (x :: forall a. a) = undefined::a here, we use 'forall' to explicitly declare new type variable. so it is equivalent to the following: f :: forall a. a -> ... f x = undefined::a where '...' used to make partial type signature -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

| just one more problem is that this issue is too complicated. i'm not | sure that i correctly understands details, but for me the situation | seems like this: in 6.4 it was no distinction between declarations and | usages of type variables - first use declared it, while in 6.6 we have | exactly defined places to declare type variable. No, that's not right. In 6.4 it was absolutely nailed down exactly where a lexical type variable was *bound* and where it was *used*. Identifying the site where it comes into scope isn't the problem. However, 6.4 allowed you to bring into scope a lexical type variable that was a name for an existing type. Whereas 6.6 brings into scope a lexical type variable only at places where the type variable it names is being quantified. Yes, it's confusing! Simon
participants (2)
-
Bulat Ziganshin
-
Simon Peyton-Jones