mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fix bug in CCOpt.filter (close #100)
This commit is contained in:
parent
5713183a3a
commit
6df16975ca
1 changed files with 7 additions and 1 deletions
|
|
@ -67,7 +67,13 @@ let map2 f o1 o2 = match o1, o2 with
|
|||
|
||||
let filter p = function
|
||||
| Some x as o when p x -> o
|
||||
| o -> o
|
||||
| _ -> None
|
||||
|
||||
(*$=
|
||||
None (filter ((=) 0) (Some 1))
|
||||
(Some 0) (filter ((=) 0) (Some 0))
|
||||
None (filter (fun _ -> true) None)
|
||||
*)
|
||||
|
||||
let if_ p x = if p x then Some x else None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue