CCOpt infix map

This commit is contained in:
Simon Cruanes 2014-06-13 17:56:32 +02:00
parent 933638244d
commit d368931f70
2 changed files with 5 additions and 0 deletions

View file

@ -54,6 +54,8 @@ let equal f o1 o2 = match o1, o2 with
let return x = Some x
let (>|=) x f = map f x
let (>>=) o f = match o with
| None -> None
| Some x -> f x

View file

@ -43,6 +43,9 @@ val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val return : 'a -> 'a t
(** Monadic return *)
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
(** Infix version of {!map} *)
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
(** Monadic bind *)