minor style changes

This commit is contained in:
Simon Cruanes 2022-01-25 12:27:46 -05:00 committed by GitHub
parent 289fc8af7b
commit a721d9aed3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -70,9 +70,11 @@ let of_exn_trace e =
let opt_map f e = match e with
| None -> Ok None
| Some x -> (match f x with
| Some x ->
begin match f x with
| Ok x -> Ok (Some x)
| Error e -> Error e)
| Error e -> Error e
end
let map f e = match e with
| Ok x -> Ok (f x)

View file

@ -64,7 +64,8 @@ val add_ctxf : ('a, Format.formatter, unit, ('b, string) t -> ('b, string) t) fo
@since 1.2 *)
val opt_map : ('a -> ('b, 'c) t) -> 'a option -> ('b option, 'c) t
(** Map optional success *)
(** Map a fallible operation through an option.
@since NEXT_RELEASE *)
val map : ('a -> 'b) -> ('a, 'err) t -> ('b, 'err) t
(** Map on success. *)