@@ -45,24 +45,32 @@ module Oak = struct
4545 | Rpresent _ -> Ident " row_field.Rpresent"
4646 | Reither _ -> Ident " row_field.Reither"
4747 | Rabsent -> Ident " row_field.Rabsent"
48+
49+ let name_of_type_desc (desc : Types.type_desc ) =
50+ match desc with
51+ | Tvar _ -> " Tvar"
52+ | Tarrow _ -> " Tarrow"
53+ | Ttuple _ -> " Ttuple"
54+ | Tconstr _ -> " Tconstr"
55+ | Tobject _ -> " Tobject"
56+ | Tfield _ -> " Tfield"
57+ | Tnil -> " Tnil"
58+ | Tlink _ -> " Tlink"
59+ | Tsubst _ -> " Tsubst"
60+ | Tvariant _ -> " Tvariant"
61+ | Tunivar _ -> " Tunivar"
62+ | Tpoly _ -> " Tpoly"
63+ | Tpackage _ -> " Tpackage"
64+
4865 let rec mk_type_desc (desc : Types.type_desc ) : oak =
66+ Printf. printf " entering mk_type_desc for %s\n " (name_of_type_desc desc);
4967 match desc with
68+ | Tlink {desc} ->
69+ Application {name = " type_desc.Tlink" ; argument = mk_type_desc desc}
5070 | Tvar var -> (
5171 match var with
5272 | None -> Application {name = " type_desc.Tvar" ; argument = Ident " None" }
5373 | Some s -> Application {name = " type_desc.Tvar" ; argument = Ident s})
54- | Tarrow (_ , t1 , t2 , _ ) ->
55- Application
56- {
57- name = " type_desc.Tarrow" ;
58- argument =
59- Tuple
60- [
61- {name = " t1" ; value = mk_type_desc t1.desc};
62- {name = " t2" ; value = mk_type_desc t2.desc};
63- ];
64- }
65- | Ttuple _ -> Ident " type_desc.Ttuple"
6674 | Tconstr (path , ts , _ ) ->
6775 let ts =
6876 ts |> List. map (fun (t : Types.type_expr ) -> mk_type_desc t.desc)
@@ -77,11 +85,21 @@ module Oak = struct
7785 {name = " ts" ; value = List ts};
7886 ];
7987 }
88+ | Tarrow (_ , t1 , t2 , _ ) ->
89+ Application
90+ {
91+ name = " type_desc.Tarrow" ;
92+ argument =
93+ Tuple
94+ [
95+ {name = " t1" ; value = mk_type_desc t1.desc};
96+ {name = " t2" ; value = mk_type_desc t2.desc};
97+ ];
98+ }
99+ | Ttuple _ -> Ident " type_desc.Ttuple"
80100 | Tobject _ -> Ident " type_desc.Tobject"
81101 | Tfield _ -> Ident " type_desc.Tfield"
82102 | Tnil -> Ident " type_desc.Tnil"
83- | Tlink {desc} ->
84- Application {name = " type_desc.Tlink" ; argument = mk_type_desc desc}
85103 | Tsubst _ -> Ident " type_desc.Tsubst"
86104 | Tvariant row_descr ->
87105 Application
0 commit comments