mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-09 12:45:34 -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
|
||||
)
|
||||
|
||||
let default b a =
|
||||
let default ~default l =
|
||||
lazy (
|
||||
match a with
|
||||
| lazy Nil -> Lazy.force b
|
||||
| lazy a -> a
|
||||
match l with
|
||||
| lazy Nil -> Lazy.force default
|
||||
| lazy l -> l
|
||||
)
|
||||
|
||||
(*$=
|
||||
|
|
@ -96,7 +96,7 @@ let default b a =
|
|||
module Infix = struct
|
||||
let (>|=) x f = map ~f x
|
||||
let (>>=) x f = flat_map ~f x
|
||||
let (<|>) = default
|
||||
let (<|>) a b = default ~default:b a
|
||||
end
|
||||
|
||||
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
|
||||
(** Monadic flatten + map. *)
|
||||
|
||||
val default : 'a t -> 'a t -> 'a t
|
||||
val default : default:'a t -> 'a t -> 'a t
|
||||
(** Choice operator.
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue