Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / mlton / atoms / layout-pretty.sml
CommitLineData
7f918cf1
CE
1(* Copyright (C) 2017 Matthew Fluet.
2 * Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 * Copyright (C) 1997-2000 NEC Research Institute.
5 *
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
8 *)
9
10structure BindingStrength =
11 struct
12 datatype t =
13 Arrow
14 | Tuple
15 | Unit
16 end
17
18structure LayoutPretty =
19 struct
20 type t = Layout.t * ({isChar: bool} * BindingStrength.t)
21
22 fun simple (l: Layout.t): t =
23 (l, ({isChar = false}, BindingStrength.Unit))
24
25 val dontCare: t = simple (Layout.str "_")
26 fun bracket ((l, ({isChar}, _)): t): t =
27 (Layout.seq [Layout.str "[", l, Layout.str "]"],
28 ({isChar = isChar}, BindingStrength.Unit))
29 end