File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 1+ open Stdlib0
2+
13module Ext_name = struct
24 let pexp_struct_item = " ppxlib.migration.pexp_struct_item_505"
35 let ptyp_functor = " ppxlib.migration.ptyp_functor_505"
@@ -92,14 +94,9 @@ module To_504 = struct
9294 | _ -> None
9395
9496 let must_preserve_ppat_constraint l =
95- let rec aux seen = function
96- | [] -> None
97- | { attr_name = { txt; _ }; _ } :: tl
98- when String. equal txt Ext_name. preserve_ppat_constraint ->
99- Some (List. rev_append seen tl)
100- | hd :: tl -> aux (hd :: seen) tl
101- in
102- aux [] l
97+ List. without_first l
98+ ~pred: (fun attr ->
99+ String. equal attr.attr_name.txt Ext_name. preserve_ppat_constraint)
103100
104101 let preserve_ppat_constraint pattern core_type =
105102 let loc = pattern.ppat_loc in
Original file line number Diff line number Diff line change @@ -30,3 +30,15 @@ module Option = struct
3030 aux [] l
3131 end
3232end
33+
34+ module List = struct
35+ include List
36+
37+ let without_first list ~pred =
38+ let rec aux seen = function
39+ | [] -> None
40+ | hd ::tl when pred hd -> Some (List. rev_append seen tl)
41+ | hd ::tl -> aux (hd::seen) tl
42+ in
43+ aux [] list
44+ end
You can’t perform that action at this time.
0 commit comments