[MLton] signature language lacking

Henry Cejtin henry.cejtin at sbcglobal.net
Tue Feb 12 20:47:46 PST 2008


Consider the following piece of SML code:

	structure S:> sig

	   type at
	   type bt

	   structure A: sig
	      type t = at
	      val f: at -> bt
	   end

	   structure B: sig
	      type t = bt
	      val f: bt -> at
	   end
	end = struct
	   ???
	   insert some code that implements the above here
	   ???
	end

	structure S: sig

	   structure A: sig
	      type t = S.at
	      val f: S.at -> S.bt
	   end

	   structure B: sig
	      type t = S.bt
	      val f: S.bt -> S.at
	   end
	end = S

Unless I am confused, the result is a structure S which has nothing in it but
two sub-structures.  Each of these two sub-structures has only a single  type
and a single function in it.  The two types are completely opaque except that
the two functions map between them.

My question is: is there any way to specify  a  signature  such  that  opaque
matching  to that signature would express exactly this?  I can't think of any
way to do this, and that means that the signature language  is  too  weak  to
specify  an  interface  to this structure, which is very disappointing.  (Not
that the signature language wasn't known to have short comings already.)

Am I missing something?



More information about the MLton mailing list