Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlton / basic / layout.sig
CommitLineData
7f918cf1
CE
1(* Copyright (C) 2009,2014,2017 Matthew Fluet.
2 * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9signature LAYOUT =
10 sig
11 type t
12
13 (* layout the objects on separate lines *)
14 val align: t list -> t
15 val alignPrefix: t list * string -> t
16 val array: t array -> t
17 (* layout the object on one line *)
18 val compact: t -> t
19 (* Whether or not to print things in detail -
20 * routines that create layouts should use this flag to decide
21 * how detailed to print.
22 *)
23 val detailed: bool ref
24 val empty: t
25 (* layout the objects on separate lines, if necessary,
26 * using a paragraph-fill style
27 *)
28 val fill: t list -> t
29 val ignore: 'a -> t
30 val isEmpty: t -> bool
31 val makeOutput: ('a -> t) -> 'a * Outstream0.t -> unit
32 (* layout the objects on separate lines, if necessary *)
33 val mayAlign: t list -> t
34 val namedRecord: string * (string * t) list -> t
35 (* indent the entire object *)
36 val indent: t * int -> t
37 val list: t list -> t
38 val output: t * Outstream0.t -> unit
39 val outputl: t * Outstream0.t -> unit
40 val outputTree: t * Outstream0.t -> unit
41 val outputWidth: t * int * Outstream0.t -> unit
42 val paren: t -> t
43 (* print the object *)
44 val print: t * (string -> unit) -> unit
45 val record: (string * t) list -> t
46 val schemeList: t list -> t
47 (* put string between elements *)
48 val separate: t list * string -> t list
49 (* adds string at beginning of all objects except first *)
50 val separateLeft: t list * string -> t list
51 (* adds string at the end of all objects except last *)
52 val separateRight: t list * string -> t list
53 val setDefaultWidth: int -> unit
54 (* layout the objects on the same line *)
55 val seq: t list -> t
56 (* convert a string to a layout object *)
57 val str: string -> t
58 val switch: {detailed: 'a -> t, normal: 'a -> t} -> 'a -> t
59 val toString: t -> string
60 val tuple: t list -> t
61 val tuple2: ('a -> t) * ('b -> t) -> 'a * 'b -> t
62 val tuple3: ('a -> t) * ('b -> t) * ('c -> t) -> 'a * 'b * 'c -> t
63 val tuple4: ('a -> t) * ('b -> t) * ('c -> t) * ('d -> t)
64 -> 'a * 'b * 'c * 'd -> t
65 val tuple5: ('a -> t) * ('b -> t) * ('c -> t) * ('d -> t) * ('e -> t)
66 -> ('a * 'b * 'c * 'd * 'e) -> t
67 val vector: t vector -> t
68 end