[MLton] flexible types
Stephen Weeks
MLton@mlton.org
Wed, 11 Feb 2004 14:25:30 -0800
> SML/NJ rejects this program, claiming that u is a definitional spec and
> can't be redefined.
This is a bug in SML/NJ.
> MLton accepts it; are flexible types in signatures
> really transitive in this manner? (i.e., t is definitely flexible, and
> can be "where type" constrained, but does that mean u can be as well?)
>
> signature S =
> sig
> datatype t = A | B | C
> type u = t
> end
>
> signature R =
> sig
> structure S : S
> end
>
> signature P =
> sig
> structure S : S
> structure R : R where type S.u = S.u
> end
Once you have "type u = t", then both t and u denote the same flexible
tycon, so "where S.u = S.u" is exactly the same as "where S.t = S.u",
i.e. they both define the same flexible tycon.