@@ -28,8 +28,7 @@ open Ppxlib
2828let string_of_expression e =
2929 Format. set_margin 1000 ;
3030 Format. set_max_indent 0 ;
31- let ans = Format. asprintf " %a" Pprintast. expression e in
32- ans
31+ Format. asprintf " %a" Pprintast. expression e
3332;;
3433
3534let name = " tester"
@@ -42,23 +41,25 @@ let () =
4241 (pstr_eval
4342 (pexp_apply
4443 __
45- ((nolabel ** __) ^:: (nolabel ** __) ^:: (nolabel ** __) ^:: (nolabel ** __) ^:: nil))
44+ ((nolabel ** __) ^:: (nolabel ** __) ^:: (nolabel ** __) ^:: (nolabel ** __) ^:: nil
45+ |> map2 ~f: (fun a b -> [ a; b ])
46+ ||| ((nolabel ** __) ^:: (nolabel ** __) ^:: nil |> map0 ~f: [] )))
4647 nil
4748 ^:: nil)
4849 in
4950 [ Extension. declare
5051 name
5152 Extension.Context. Expression
5253 pattern
53- (fun ~loc ~path :_ runner reifier shower n realtion ->
54+ (fun ~loc ~path :_ runner reifier_shower n relation ->
5455 let open Ppxlib.Ast_builder.Default in
5556 let count =
5657 let rec helper acc e =
5758 match e.pexp_desc with
5859 | Pexp_fun (_ , _ , _ , body ) -> helper (1 + acc) body
5960 | _ -> acc
6061 in
61- helper 0 realtion
62+ helper 0 relation
6263 in
6364 let middle =
6465 match count with
@@ -70,13 +71,13 @@ let () =
7071 | _ -> failwith (Printf. sprintf " 5 and more arguments are not supported" )
7172 in
7273 let last =
73- let s = string_of_expression @@ realtion in
74+ let s = string_of_expression relation in
7475 let open Ppxlib.Ast_builder.Default in
75- [% expr [% e pexp_constant ~loc (Pconst_string (s, loc, None ))], [% e realtion ]]
76+ [% expr [% e pexp_constant ~loc (Pconst_string (s, loc, None ))], [% e relation ]]
7677 in
7778 pexp_apply ~loc runner
7879 @@ List. map (fun e -> Nolabel , e)
79- @@ List. concat [ [ reifier; shower; n ]; middle; [ last ] ])
80+ @@ List. concat [ reifier_shower @ [ n ]; middle; [ last ] ])
8081 ]
8182 in
8283 Ppxlib.Driver. register_transformation ~extensions name
0 commit comments