1 (* Copyright (C) 2017 Matthew Fluet.
2 * Copyright (C) 1999-2007 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 TYPE_ENV_STRUCTS =
17 include TYPE_ENV_STRUCTS
24 val tick: {region: Region.t} -> unit
31 (* can two types be unified? not side-effecting. *)
32 val canUnify: t * t -> bool
34 t * Time.t * {layoutPrettyTycon: Tycon.t -> Layout.t,
35 layoutPrettyTyvar: Tyvar.t -> Layout.t}
36 -> (Layout.t * t * {tycons: Tycon.t list, tyvars: Tyvar.t list}) option
38 val deEta: t * Tyvar.t vector -> Tycon.t option
39 val deRecord: t -> (Record.Field.t * t) vector
40 val flexRecord: t SortedRecord.t -> t * (unit -> bool)
41 val hom: t * {con: Tycon.t * 'a vector -> 'a,
43 record: 'a SortedRecord.t -> 'a,
44 replaceSynonyms: bool,
45 var: Tyvar.t -> 'a} -> 'a
46 val isArrow: t -> bool
48 val isCharX: t -> bool
49 val isCPointer: t -> bool
52 val isUnknown: t -> bool
53 val layout: t -> Layout.t
55 t * {expandOpaque: bool,
56 layoutPrettyTycon: Tycon.t -> Layout.t,
57 layoutPrettyTyvar: Tyvar.t -> Layout.t}
59 val makeHom: {con: Tycon.t * 'a vector -> 'a,
61 var: Tyvar.t -> 'a} -> {destroy: unit -> unit,
65 layoutPrettyTycon: Tycon.t -> Layout.t,
66 layoutPrettyTyvar: Tyvar.t -> Layout.t}
67 -> {destroy: unit -> unit,
68 layoutPretty: t -> LayoutPretty.t}
70 val record: t SortedRecord.t -> t
71 (* make two types identical (recursively). side-effecting. *)
73 t * t * {error: Layout.t * Layout.t * {notes: unit -> Layout.t} -> unit,
74 layoutPretty: t -> LayoutPretty.t,
75 layoutPrettyTycon: Tycon.t -> Layout.t,
76 layoutPrettyTyvar: Tyvar.t -> Layout.t}
78 val unresolvedChar: unit -> t
79 val unresolvedInt: unit -> t
80 val unresolvedReal: unit -> t
81 val unresolvedString: unit -> t
82 val unresolvedWord: unit -> t
85 (* sharing type Type.intSize = IntSize.t *)
86 sharing type Type.realSize = RealSize.t
87 sharing type Type.wordSize = WordSize.t
88 sharing type Type.tycon = Tycon.t
94 val admitsEquality: t -> bool
95 val apply: t * Type.t vector -> Type.t
96 val checkEquality: t * {layoutPrettyTycon: Tycon.t -> Layout.t} -> Layout.t option
97 val dest: t -> Tyvar.t vector * Type.t
98 val fresh: t -> Tyvar.t vector * Type.t
99 val fromTycon: Tycon.t -> t
100 val fromType: Type.t -> t
101 val haveUnknowns: t -> bool
102 val instantiate: t -> {args: unit -> Type.t vector,
104 val kind: t -> TyconKind.t
105 val layout: t -> Layout.t
106 val make: {canGeneralize: bool,
108 tyvars: Tyvar.t vector} -> t
115 val makeString: string * {equality: bool} -> t
116 val makeNoname: {equality: bool} -> t
117 val makeLayoutPretty:
119 {destroy: unit -> unit,
120 layoutPretty: t -> Layout.t,
121 localInit: t vector -> unit}
122 val makeLayoutPrettyLocal:
124 {destroy: unit -> unit,
125 layoutPretty: t -> Layout.t,
129 sharing type TyvarExt.t = Tyvar.t
134 val admitsEquality: t -> AdmitsEquality.t
135 val kind: t -> TyconKind.t
136 val layoutPrettyDefault: t -> Layout.t
137 val make: {admitsEquality: AdmitsEquality.t,
140 prettyDefault: string,
141 region: Region.t} -> t
142 val makeBogus: {name: string,
144 region: Region.t option} -> t
146 val region: t -> Region.t
147 val scopeNew: (unit -> 'a) -> ('a * t list)
148 val setAdmitsEquality: t * AdmitsEquality.t -> unit
149 val setOpaqueExpansion: t * (Type.t vector -> Type.t) -> unit
151 sharing type TyconExt.t = Tycon.t
156 * {isExpansive: bool, ty: Type.t, var: 'a} vector
157 * {error: 'a * Layout.t * Tyvar.t list -> unit,
158 layoutPrettyTycon: Tycon.t -> Layout.t,
159 layoutPrettyTyvar: Tyvar.t -> Layout.t})
160 -> {bound: unit -> Tyvar.t vector,
161 schemes: Scheme.t vector}