MLton 20100608 MLtonWorld
Home  Index  
signature MLTON_WORLD =
   sig
      datatype status = Clone | Original

      val load: string -> 'a
      val save: string -> status
      val saveThread: string * Thread.Runnable.t -> unit
   end

Example

Suppose that save-world.sml contains the following.

open MLton.World
val _ =
   case save "world" of
      Original => print "I am the original\n"
    | Clone => print "I am the clone\n"

Then, if we compile save-world.sml and run it, the Original branch will execute, and a file named world will be created.

% mlton save-world.sml
% save-world
I am the original

We can then load world using the load-world run time option.

% save-world @MLton load-world world --
I am the clone


Last edited on 2007-08-23 03:46:03 by MatthewFluet.