[MLton] Error Messages for Missing Sharing/Where Type

Stephen Weeks sweeks@sweeks.com
Fri, 30 Jun 2006 15:59:55 -0700


> it will give a message saying that A1.a, A2.a cannot be unified as
> usual, but will also say something like "Both A1.a and A2.a are
> flexible type constructors: are you missing a sharing constraint?"

Ok.  In elaborate-env.fun, the "dummyStructure" function is used to
create a representative of an interface (elaborated signature) for the
elaboration of a functor body.  That function creates new tycons to
instantiate the flexible tycons in the interface, and so could use a
property to annotate each new tycon it creates.

> To do this, it seems like it would be necessary to know either in
> TypeEnv.Type.conAnd or at the time of the various calls to unify in
> elaborate-core.fun whether particular type constructors are flexible
> or rigid.

This code could simply look at the property on the tycons.


When in doubt, the MLtonian way is to use properties :-).