1 (* Copyright (C) 2015,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.
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
10 signature CORE_ML_STRUCTS =
19 val deConOpt: t -> (Tycon.t * t vector) option
20 val deRecord: t -> (Record.Field.t * t) vector
21 val isCharX: t -> bool
23 val layout: t -> Layout.t
24 val makeHom: {con: Tycon.t * 'a vector -> 'a,
25 var: Tyvar.t -> 'a} -> {destroy: unit -> unit,
27 val tuple: t vector -> t
34 include CORE_ML_STRUCTS
40 Con of {arg: t option,
43 | Const of unit -> Const.t
44 | Layered of Var.t * t
47 | Record of t Record.t
52 val dest: t -> node * Type.t
54 val foreachVar: t * (Var.t -> unit) -> unit
55 (* true if pattern contains a constant, constructor or variable *)
56 val isRefutable: t -> bool
59 val layout: t -> Layout.t
60 val make: node * Type.t -> t
62 val var: Var.t * Type.t -> t
64 val tuple: t vector -> t
74 datatype noMatch = Impossible | RaiseAgain | RaiseBind | RaiseMatch
77 | Case of {ctxt: unit -> Layout.t,
78 kind: string * string,
80 matchDiags: {nonexhaustiveExn: Control.Elaborate.DiagDI.t,
81 nonexhaustive: Control.Elaborate.DiagEIW.t,
82 redundant: Control.Elaborate.DiagEIW.t},
86 layPat: (unit -> Layout.t) option,
88 regionPat: Region.t} vector,
90 | Con of Con.t * Type.t vector
91 | Const of unit -> Const.t
92 | EnterLeave of t * SourceInfo.t
93 | Handle of {catch: Var.t * Type.t,
97 | Let of dec vector * t
99 | PrimApp of {args: t vector,
101 targs: Type.t vector}
103 | Record of t Record.t
105 | Var of (unit -> Var.t) * (unit -> Type.t vector)
108 val andAlso: t * t -> t
109 val casee: {ctxt: unit -> Layout.t,
110 kind: string * string,
112 matchDiags: {nonexhaustiveExn: Control.Elaborate.DiagDI.t,
113 nonexhaustive: Control.Elaborate.DiagEIW.t,
114 redundant: Control.Elaborate.DiagEIW.t},
118 layPat: (unit -> Layout.t) option,
120 regionPat: Region.t} vector,
122 val dest: t -> node * Type.t
123 val iff: t * t * t -> t
125 val foreachVar: t * (Var.t -> unit) -> unit
126 (* true if the expression may side-effect. See p 19 of Definition *)
127 val isExpansive: t -> bool
128 val lambda: lambda -> t
129 val layout: t -> Layout.t
130 val layoutWithType: t -> Layout.t
131 val make: node * Type.t -> t
133 val orElse: t * t -> t
135 val tuple: t vector -> t
138 val var: Var.t * Type.t -> t
139 val whilee: {expr: t, test: t} -> t
147 val dest: t -> {arg: Var.t,
151 val make: {arg: Var.t,
154 mayInline: bool} -> t
156 sharing type Exp.lambda = Lambda.t
161 Datatype of {cons: {arg: Type.t option,
164 tyvars: Tyvar.t vector} vector
165 | Exception of {arg: Type.t option,
167 | Fun of {decs: {lambda: Lambda.t,
169 tyvars: unit -> Tyvar.t vector}
170 | Val of {matchDiags: {nonexhaustiveExn: Control.Elaborate.DiagDI.t,
171 nonexhaustive: Control.Elaborate.DiagEIW.t,
172 redundant: Control.Elaborate.DiagEIW.t},
173 rvbs: {lambda: Lambda.t,
175 tyvars: unit -> Tyvar.t vector,
176 vbs: {ctxt: unit -> Layout.t,
178 layPat: unit -> Layout.t,
181 regionPat: Region.t} vector}
183 val layout: t -> Layout.t
185 sharing type Exp.dec = Dec.t
189 datatype t = T of {decs: Dec.t vector}
191 val layouts: t * (Layout.t -> unit) -> unit