/
simp-type.sml
48 lines (40 loc) · 1.08 KB
/
simp-type.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
36
37
38
39
40
41
42
43
44
45
46
47
48
functor SimpTypeFn (structure Type : TYPE
val simp_i : Type.idx -> Type.idx
val simp_s : Type.sort -> Type.sort
val subst_i_mt : Type.idx -> Type.mtype -> Type.mtype
) = struct
structure Visitor = TypeVisitorFn (structure S = Type
structure T = Type)
open Visitor
open Type
open SimpUtil
infixr 0 $
fun simp_type_visitor_vtable cast () =
let
fun extend_i this env name = (env + 1, name)
in
default_type_visitor_vtable
cast
extend_noop
extend_noop
visit_noop
visit_noop
(ignore_this_env simp_i)
(ignore_this_env simp_s)
visit_noop
visit_noop
end
fun new_simp_type_visitor a = new_type_visitor simp_type_visitor_vtable a
fun simp_mt b =
let
val visitor as (TypeVisitor vtable) = new_simp_type_visitor ()
in
#visit_mtype vtable visitor 0 b
end
fun simp_t b =
let
val visitor as (TypeVisitor vtable) = new_simp_type_visitor ()
in
#visit_ty vtable visitor 0 b
end
end