[MLton] Install problem

Stephen Weeks MLton@mlton.org
Mon, 3 Nov 2003 13:55:04 -0800


> By the way, do you have any suggestion for the debugging? I'm not
> familiar with ML language. Can I set breakpoints in my program or
> can I see the values of variant in the running time?

Unfortunately, MLton does not have a debugger.  It is fairly high on
our list of things to work on, and we would love to find someone else
who would like to do it that we could help.  But it is almost
certainly a year or more away.

In the mean time, there are of course print statements.  :-)

You can also use polymorphism and higher-order functions to build your
own debugging aids.  For example, you could implement

val debug: ('a -> string) * ('b -> string) -> ('a -> 'b) -> ('a -> 'b)

This function could then handle pretty printing of arguments and
results, indentation for nesting, all under the control of some flag
(bool ref).

We've done a pretty full (and complicated) implementation of this idea
in the MLton sources.  See lib/mlton/basic/trace.{sig,sml} in the
mlton sources.

	http://cvs.mlton.org/cgi-bin/viewcvs.cgi/mlton/mlton/lib/mlton/basic/trace.sig?rev=HEAD&content-type=text/vnd.viewcvs-markup

It's quite a lot to digest, though.  And since you're new to ML, it
would probably be very instructive to build your own infrastructure
along the lines above.