[Haskell] Re: GHC Error question

rossberg at ps.uni-sb.de rossberg at ps.uni-sb.de
Thu Dec 7 02:51:30 EST 2006


oleg at pobox.com wrote:
>
> I'm afraid I may disagree about the quantification. Also, I'm cautious
> about the phrase "ML and Haskell". In GHC 6.4, local type variables
> behave pretty much like those in ML (actually, GHC 6.2 was closer). In
> GHC 6.6, the behavior is completely different!
>
> Regarding the quantification: in ML (OCaml) we can write
> 	let foo (x:'a) y = (x+1,(y:'a))
> That does not mean that foo has the type forall 'a. 'a -> 'a -> ...
> Indeed, foo is not polymorphic and its inferred type is int -> int ->
> int * int. If there should be a quantifier in the above type, it
> probably should be 'exists' rather than 'forall'.  It seems in ML, the
> type variables are better understood as names of some types;

Be cautious about the phrase "ML" here as well. ;-) Because what you
describe only applies to OCaml. In Standard ML, the semantics of type
variables in annotations is saner: the equivalent of the above declaration
would be rejected. AFAICS it is basically equivalent to the new behaviour
of GHC 6.6.

Cheers,
- Andreas




More information about the Haskell mailing list