[MLton] On "layout.sig, sml"

Baojian Hua huabj at mail.ustc.edu.cn
Mon Nov 30 17:49:10 PST 2009


hi, 

We've been useing MLton for over 7 years for our research
projects, and recently we're planning to read and hack some source
code of MLton (and hopefully we can contribute in the
future).

And we start by reading sources in "lib/mlton/basic/", but 
the documentation is rare, so we have to send some questions here:
in files "layout.sig, sml", this data structure:

datatype t = T of {length: int,
                   tree: tree}
and tree =
   Empty
  | String of string
  | Sequence of t list
  | Align of {force: bool, rows: t list}
  | Indent of t * int

Does the "force" mean we must align several line? And in calculating
the length, I'd expect to see this:

case tree 
 of Align {rows, ...} => max (rows)  (* the longest one *)
  | _ => 

but the code is this:

case tree 
 of Align {rows, ...} => \Sigma (rows)  (* the whole *)
  | _ => 



Thanks.

-Paul




More information about the MLton mailing list