Skip to content

Commit

Permalink
ExtList: break type of find_map to match stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrek committed Jan 17, 2021
1 parent 8809929 commit 4ef8bc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/extList.ml
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ let rec find_map_exn f = function
| Some y -> y
| None -> find_map_exn f xs

let find_map = find_map_exn

let rec find_map_opt f = function
| [] -> None
| x :: xs ->
match f x with
| Some _ as y -> y
| None -> find_map_opt f xs

let find_map = find_map_opt

let fold_right_max = 1000

let fold_right f l init =
Expand Down
9 changes: 4 additions & 5 deletions src/extList.mli
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ module List :
be renamed to stay compatible with OCaml 4.10.
*)

val find_map : ('a -> 'b option) -> 'a list -> 'b
#if OCAML >= 402
[@@ocaml.deprecated "this function will change type to stay compatible with OCaml 4.10 in next extlib release, use ExtList.find_map_exn instead"]
#endif

val find_map_opt : ('a -> 'b option) -> 'a list -> 'b option
(** same as find_map_exn but returning option *)

val find_map : ('a -> 'b option) -> 'a list -> 'b option
(** same as find_map_opt *)

val split_nth : int -> 'a list -> 'a list * 'a list
(** [split_nth n l] returns two lists [l1] and [l2], [l1] containing the
Expand Down

0 comments on commit 4ef8bc2

Please sign in to comment.