-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathres_doc.mli
67 lines (61 loc) · 1.83 KB
/
res_doc.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
type t
val nil : t
val line : t
val hard_line : t
val soft_line : t
val literal_line : t
val text : string -> t
val concat : t list -> t
val indent : t -> t
val if_breaks : t -> t -> t
val line_suffix : t -> t
val group : t -> t
val breakable_group : force_break:bool -> t -> t
(* `customLayout docs` will pick the layout that fits from `docs`.
* This is a very expensive computation as every layout from the list
* will be checked until one fits. *)
val custom_layout : t list -> t
val break_parent : t
val join : sep:t -> t list -> t
(* [(doc1, sep1); (doc2,sep2)] joins as doc1 sep1 doc2 *)
val join_with_sep : (t * t) list -> t
val space : t
val comma : t
val dot : t
val dotdot : t
val dotdotdot : t
val less_than : t
val greater_than : t
val lbrace : t
val rbrace : t
val lparen : t
val rparen : t
val lbracket : t
val rbracket : t
val question : t
val tilde : t
val equal : t
val trailing_comma : t
val double_quote : t [@@live]
(*
* `willBreak doc` checks whether `doc` contains forced line breaks.
* This is more or less a "workaround" to make the parent of a `customLayout` break.
* Forced breaks are not propagated through `customLayout`; otherwise we would always
* get the last layout the algorithm tries…
* This might result into some weird layouts:
* [fn(x => {
* let _ = x
* }), fn(y => {
* let _ = y
* }), fn(z => {
* let _ = z
* })]
* The `[` and `]` would be a lot better broken out.
* Although the layout of `fn(x => {...})` is correct, we need to break its parent (the array).
* `willBreak` can be used in this scenario to check if the `fn…` contains any forced breaks.
* The consumer can then manually insert a `breakParent` doc, to manually propagate the
* force breaks from bottom to top.
*)
val will_break : t -> bool
val to_string : width:int -> t -> string
val debug : t -> unit [@@live]