[Haskell] Re: GHC Error question

Norman Ramsey nr at eecs.harvard.edu
Thu Dec 7 21:11:19 EST 2006

 > 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 -> ...

Type annotations in OCaml are completely broken and always have been.
They use 'unifies with' instead of 'is an instance of' and it renders
type annotations nearly useless.  If you want to ensure that a
function is polymorphic, you have to play horrible games with
uninhabited types.  I am extremely bitter about this.

The analogous declaration in *Standard* ML, which gets this right, is

  fun 'a foo (x:'a) y = (x + 1, (y:'a))

and as might be expected, this declaration is vigorously rejected by
the type checker.  As it damn well ought to be.

Thanks for the pointers to the new GHC rules.
Maybe one day I will learn them well enough to know if I should be
bitter about them, too :-)


More information about the Haskell mailing list