# MLton User Guide

### Copyright © 2004
Henry Cejtin, Matthew Fluet, Suresh Jagannathan, and Stephen Weeks

### October 16, 2004

This document describes how to install and use MLton, the whole-program optimizing compiler for the Standard ML programming language. MLton is distributed under the GNU General Public License (for details, see the `MLton-LICENSE` file).
The MLton homepage is `http://www.mlton.org/`. For general MLton discussion, send mail to `MLton-user@mlton.org`. To contact the MLton developers, send mail to `MLton@mlton.org`.
This document describes MLton version 20040227.

- Getting started
  - Installation
  - Hello, World!
- Features of MLton
- Drawbacks of MLton
- Type Checking
  - Type error messages
  - Type information about programs
- Manual page
  - Compile-time options
  - Runtime system options
- Foreign function interface (FFI)
  - Calling from SML to C
  - Calling from C to SML
  - FFI types
- Profiling
  - Profiling the stack
  - Call graphs
  - Using `MLton.Profile`
  - Profiling details
- Basis library
  - Toplevel types and constructors
  - Top level exception constructors
  - Top level values
  - Top level signatures
  - Top level structures
  - Top level functors
- MLton extensions
  - `#line` directives
  - The `MLton` structure
    - `MLton`
    - `MLton.Array`
    - `MLton.BinIO`
    - `MLton.Cont`
    - `MLton.Exn`
    - `MLton.Finalizable`
    - `MLton.GC`
    - `MLton.IntInf`
    - `MLTON_IO`
    - `MLton.Itimer`
    - `MLton.Platform`
    - `MLton.Pointer`
    - `MLton.ProcEnv`
    - `MLton.Process`
    - `MLton.Profile`
    - `MLton.Random`
    - `MLton.Rlimit`
    - `MLton.Rusage`
    - `MLton.Signal`
    - `MLton.Socket`
    - `MLton.Syslog`
    - `MLton.TextIO`
    - `MLton.Thread`
    - `MLton.Vector`
    - `MLton.Weak`
    - `MLton.Word, MLton.Word8`
    - `MLton.World`
  - `SMLofNJ: SML_OF_NJ`
  - `Unsafe: UNSAFE`
- CM
  - Comparison with CM
  - Porting SML/NJ CM files to MLton
- Compiling MLton
  - Compiling with MLton
  - Compiling with SML/NJ
- Platform-specific notes
  - Running on Cygwin/Windows
  - Running on FreeBSD
  - Running on Sparc/Solaris
- Cross compiling
  - Cross compiling alternatives
- Bugs
  - Reporting a bug
  - Unresolved bugs
- Credits
- References
- Deviations of SML/NJ from Standard ML
  - Deviations of SML/NJ from the Basis Library Specification

> This document was translated from LATEX by HEVEA and HACHA.