-
Notifications
You must be signed in to change notification settings - Fork 0
/
minml-typed.sml
35 lines (33 loc) · 1.02 KB
/
minml-typed.sml
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
structure MinMLTyped =
struct
datatype typ =
TVar of (int * string)
| TForall of typ (* binds a variable *)
| TArrow of typ * typ
| TUnit
| TProd of typ * typ
| TSum of typ * typ
| TList of typ
| TEVar of evar
and bind =
Free of int
| Unified of typ
withtype evar = bind ref
datatype expr =
EVar of (int * string) (* carries a name for printing *)
| EApp of expr * expr
| ELam of typ * expr (* binds a variable *)
| EPlam of expr (* binds a variable *)
| EPapp of expr * typ
| EFix of typ * expr (* binds a variable *)
| ELet of expr * expr (* binds a variable in arg 2 *)
| EUnit
| EPair of expr * expr
| EFst of expr
| ESnd of expr
| EInl of expr * typ
| EInr of expr * typ
| ECase of expr * expr * expr (* binds a variable in args 2 and 3 *)
| ERollList of expr
| EUnrollList of expr
end