MLton 20051202 Installation
Home  Index  
MLton runs on a variety of platforms and is distributed in both source and binary form. The format for the binary package depends on the platform. The binary package will install under /usr or /usr/local, depending on the platform. If you install MLton somewhere else, you must set the lib variable in the /usr/bin/mlton script to the directory that contains the libraries (/usr/lib/mlton by default).

MLton requires that you have the [WWW]GNU multiprecision library installed on your machine. MLton must be able to find both the gmp.h include file and the libgmp.a or libgmp.so library. If you see the error message gmp.h: No such file or directory, you should copy gmp.h to /usr/lib/mlton/self/include. If you see the error message /usr/bin/ld: cannot find -lgmp, you should add a -link-opt -L argument in the /usr/bin/mlton script so that the linker can find libgmp. If, for example, libgmp.a is in /tmp, then add -link-opt -L/tmp.

Installation of MLton creates the following files and directories.

Hello, World!

Once you have installed MLton, create a file called hello-world.sml with the following contents.

print "Hello, world!\n";
Now create an executable, hello-world, with the following command.
mlton hello-world.sml
You can now run hello-world to verify that it works. There are more small examples in /usr/share/doc/mlton/examples.


Last edited on 2005-12-01 04:45:57 by StephenWeeks.