[MLton-user] withtype and and disparity

Stephen Weeks sweeks@sweeks.com
Wed, 17 Mar 2004 19:27:45 -0800


> The above code snip compiles in SML/NJ, does not in MLton.  
> 
> I don't know if there is bug or this is ambiguous area of the spec open
> to implementation interpretation.  But I would like to be able to
> compile it or its equivalent in MLTon.

It is a deviation of SML/NJ from the Definition of SML that causes
SML/NJ to accept this program.  This particular deviation is
documented at

	http://www.mlton.org/user-guide/Deviations_SML_NJ_from.html

Look for

	SML/NJ does not expand the withtype derived form as described
	by the Definition. 

To make your code SML, you need to either manually expand the type of
alpha_node within alpha_network, which I would not recommend, or make
alpha_node and/or alpha_network datatypes, which I would recommend.
Actually, I would recommend making both of them datatypes.