Next Previous Contents

5. Modules specific to MLton

This section describes the modules MLton makes available that are not part of the basis library.

5.1 MLton: MLTON

signature MLTON =
   sig
      structure GC:
         sig
            val messages: bool -> unit
            val summary: bool -> unit
         end
      val cleanAtExit: unit -> unit
      val random: unit -> Word32.word
      val safe: bool
      datatype status = Original | Clone
      val saveWorld: string -> status
      val size: 'a -> int

      type 'a cont
      val callcc: ('a cont -> 'a) -> 'a
      val throw: 'a cont -> 'a -> 'b
   end

5.2 SMLofNJ: SML_OF_NJ

SMLofNJ implements a subset of the structure of the same name provided in Standard ML of New Jersey. It is included to make it easier to port programs between the two systems. The semantics of these functions may be different than in SML/NJ.

signature SML_OF_NJ =
   sig
      structure Cont:
         sig
            type 'a cont
            val callcc: ('a cont -> 'a) -> 'a
            val throw: 'a cont -> 'a -> 'b
         end
      structure SysInfo:
         sig
            val getHostArch: unit -> string
            val getOSName: unit -> string
         end
      structure Internals:
         sig
            structure GC:
               sig
                  val messages: bool -> unit
               end             
         end
      val exportFn: string * (string * string list -> OS.Process.status) -> unit
      val exportML: string -> bool
      val getCmdName: unit -> string
      val getArgs: unit -> string list
      val getAllArgs: unit -> string list
   end

5.3 Unsafe: UNSAFE

This module is a subset of the Unsafe module provided by SML/NJ. It is included in MLton because the code generated by ML-Yacc includes references to unsafe subscript operations.

signature UNSAFE =
  sig
    structure Vector : UNSAFE_VECTOR
    structure Array  : UNSAFE_ARRAY

    structure CharVector : UNSAFE_MONO_VECTOR
      where type vector = CharVector.vector
      where type elem = CharVector.elem
    structure CharArray : UNSAFE_MONO_ARRAY
      where type array = CharArray.array
      where type elem = CharArray.elem

    structure Word8Vector : UNSAFE_MONO_VECTOR
      where type vector = Word8Vector.vector
      where type elem = Word8Vector.elem
    structure Word8Array : UNSAFE_MONO_ARRAY
      where type array = Word8Array.array
      where type elem = Word8Array.elem
    structure Real64Array : UNSAFE_MONO_ARRAY
      where type array = Real64Array.array
      where type elem = Real64Array.elem
  end

Next Previous Contents