[MLton] free type variables in datatype decs

Stephen Weeks MLton@mlton.org
Thu, 3 Feb 2005 12:35:54 -0800


> > MLton has a pass, scope inference, that runs before type inference and
> > determines the scope of each implicitly-scoped type variable.  That
> > seems to be what 4.6 specifies, except that 4.6 doesn't state as
> > clearly as it might that every type variable must be scoped somewhere.
> 
> In fact, that is not the case: exception declarations may contain free type
> variables, as long as they do not propagate to the toplevel.

I agree that the rules allow this.  However, as with your other
example, MLton rejects such declarations as inconsistent with the
intent of section 4.6 -- they have no val dec to scope the type
variables.