[MLton] Minor front-end extension

Henry Cejtin henry@sourcelight.com
Wed, 11 Aug 2004 12:22:37 -0500


One  idiom that would probably be hard to nail that I use all the time is the
case where a structure has a complicated (i.e.,  long)  datatype  in  it.   I
really don't like having to write the full datatype in both the signature and
the structure.  (It is true that any lack of synchronisation is checked,  but
it is very verbose and hides what is actually going on.)

The idiom that I use is

        structure S =
           struct
              ...
              datatype t = ....
              ...
           end

        structure S =
           S: sig
                 ...
                 datype t = datatype S.t
                 ...
              end