mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-10 13:13:56 -05:00
default uses labelled argument
This commit is contained in:
parent
68ad3d7408
commit
8f4c1a24b7
2 changed files with 6 additions and 6 deletions
|
|
@ -82,11 +82,11 @@ let rec flat_map ~f l =
|
||||||
Lazy.force res
|
Lazy.force res
|
||||||
)
|
)
|
||||||
|
|
||||||
let default b a =
|
let default ~default l =
|
||||||
lazy (
|
lazy (
|
||||||
match a with
|
match l with
|
||||||
| lazy Nil -> Lazy.force b
|
| lazy Nil -> Lazy.force default
|
||||||
| lazy a -> a
|
| lazy l -> l
|
||||||
)
|
)
|
||||||
|
|
||||||
(*$=
|
(*$=
|
||||||
|
|
@ -96,7 +96,7 @@ let default b a =
|
||||||
module Infix = struct
|
module Infix = struct
|
||||||
let (>|=) x f = map ~f x
|
let (>|=) x f = map ~f x
|
||||||
let (>>=) x f = flat_map ~f x
|
let (>>=) x f = flat_map ~f x
|
||||||
let (<|>) = default
|
let (<|>) a b = default ~default:b a
|
||||||
end
|
end
|
||||||
|
|
||||||
include Infix
|
include Infix
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ val append : 'a t -> 'a t -> 'a t
|
||||||
val flat_map : f:('a -> 'b t) -> 'a t -> 'b t
|
val flat_map : f:('a -> 'b t) -> 'a t -> 'b t
|
||||||
(** Monadic flatten + map. *)
|
(** Monadic flatten + map. *)
|
||||||
|
|
||||||
val default : 'a t -> 'a t -> 'a t
|
val default : default:'a t -> 'a t -> 'a t
|
||||||
(** Choice operator.
|
(** Choice operator.
|
||||||
@since NEXT_RELEASE *)
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue