-
Notifications
You must be signed in to change notification settings - Fork 0
/
infer.mli
31 lines (24 loc) · 1.13 KB
/
infer.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
open Ast
open TypedAst
(******************************************************************************)
(** type inference helpers **)
(******************************************************************************)
(** Eq (t1,t2) is an assertion that t1 must be equal to t2 *)
type equation = Eq of typ * typ
(** Functions for printing lists of equations *)
val format_eqns : Format.formatter -> equation list -> unit
val print_eqns : equation list -> unit
val string_of_eqns : equation list -> string
(**
* collect traverses an expression e and returns a list of equations that must
* be satisfied for e to typecheck.
*)
val collect : variant_spec list -> annotated_expr -> equation list
(******************************************************************************)
(** type inference **)
(******************************************************************************)
(**
* given an expression, return the type for that expression,
* failing if it cannot be typed.
*)
val infer : variant_spec list -> expr -> annotated_expr