diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/option.ml | 7 | ||||
| -rw-r--r-- | lib/option.mli | 6 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/option.ml b/lib/option.ml index 5539058136..95a18396bb 100644 --- a/lib/option.ml +++ b/lib/option.ml @@ -100,10 +100,9 @@ let fold_right f x a = (** {6 More Specific operations} ***) -(** [default f x a] is [f y] if [x] is [Some y] and [a] otherwise. *) -let default f x a = - match x with - | Some y -> f y +(** [default a x] is [y] if [x] is [Some y] and [a] otherwise. *) +let default a = function + | Some y -> y | _ -> a (** [lift f x] is the same as [map f x]. *) diff --git a/lib/option.mli b/lib/option.mli index 4047ebe1a2..c1260d9acf 100644 --- a/lib/option.mli +++ b/lib/option.mli @@ -69,10 +69,10 @@ val fold_right : ('a -> 'b -> 'b) -> 'a option -> 'b -> 'b (** {6 More Specific Operations} ***) -(** [default f x a] is [f y] if [x] is [Some y] and [a] otherwise. *) -val default : ('a -> 'b) -> 'a option -> 'b -> 'b +(** [default a x] is [y] if [x] is [Some y] and [a] otherwise. *) +val default : 'a -> 'a option -> 'a -(** [lift f x] is the same as [map f x]. *) +(** [lift] is the same as {!map}. *) val lift : ('a -> 'b) -> 'a option -> 'b option (** [lift_right f a x] is [Some (f a y)] if [x] is [Some y], and |
