1
1
(* Uncurried AST *)
2
2
3
- let uncurried_type ~loc ~arity (t_arg : Parsetree.core_type ) =
4
- let t_arg =
5
- match t_arg.ptyp_desc with
6
- | Ptyp_arrow (l , t1 , t2 , _ ) ->
7
- {t_arg with ptyp_desc = Ptyp_arrow (l, t1, t2, Some arity)}
8
- | _ -> assert false
9
- in
10
- Ast_helper.Typ. constr ~loc {txt = Lident " function$" ; loc} [t_arg]
3
+ let uncurried_type ~arity (t_arg : Parsetree.core_type ) =
4
+ match t_arg.ptyp_desc with
5
+ | Ptyp_arrow (l , t1 , t2 , _ ) ->
6
+ {t_arg with ptyp_desc = Ptyp_arrow (l, t1, t2, Some arity)}
7
+ | _ -> assert false
11
8
12
9
let uncurried_fun ~arity fun_expr =
13
10
let fun_expr =
@@ -44,8 +41,9 @@ let tarrow_to_arity_opt (t_arity : Types.type_expr) =
44
41
| _ -> None
45
42
46
43
let make_uncurried_type ~env ~arity (t : Types.type_expr ) =
47
- let lid : Longident.t = Lident " function$" in
48
- let path = Env. lookup_type lid env in
44
+ (* let lid : Longident.t = Lident "function$" in
45
+ let path = Env.lookup_type lid env in *)
46
+ let _ = env in
49
47
let t =
50
48
match t.desc with
51
49
| Tarrow (l , t1 , t2 , c , _ ) ->
@@ -54,17 +52,13 @@ let make_uncurried_type ~env ~arity (t : Types.type_expr) =
54
52
| Tvar _ -> t
55
53
| _ -> assert false
56
54
in
57
- Ctype. newconstr path [t]
55
+ t
58
56
59
57
let uncurried_type_get_arity ~env typ =
60
- match (Ctype. expand_head env typ).desc with
61
- | Tconstr (Pident {name = "function$" } , [t ], _ ) -> tarrow_to_arity t
62
- | _ -> assert false
58
+ tarrow_to_arity (Ctype. expand_head env typ)
63
59
64
60
let uncurried_type_get_arity_opt ~env typ =
65
- match (Ctype. expand_head env typ).desc with
66
- | Tconstr (Pident {name = "function$" } , [t ], _ ) -> Some (tarrow_to_arity t)
67
- | _ -> None
61
+ tarrow_to_arity_opt (Ctype. expand_head env typ)
68
62
69
63
let remove_function_dollar ?env typ =
70
64
match
@@ -73,15 +67,12 @@ let remove_function_dollar ?env typ =
73
67
| None -> Ctype. repr typ)
74
68
.desc
75
69
with
76
- | Tconstr (Pident {name = "function$" } , [t ], _ ) -> t
77
70
| _ -> typ
78
71
79
72
let core_type_remove_function_dollar (typ : Parsetree.core_type ) =
80
73
match typ.ptyp_desc with
81
- | Ptyp_constr ({txt = Lident "function$" } , [t ]) -> t
82
74
| _ -> typ
83
75
84
76
let tcore_type_remove_function_dollar (typ : Typedtree.core_type ) =
85
77
match typ.ctyp_desc with
86
- | Ttyp_constr (Pident {name = "function$" } , _ , [t ]) -> t
87
78
| _ -> typ
0 commit comments