add CCOrd.Infix

This commit is contained in:
Simon Cruanes 2017-01-24 22:19:59 +01:00
parent 6823015b63
commit d76d3b95e3
2 changed files with 15 additions and 0 deletions

View file

@ -123,3 +123,10 @@ let array ord a1 a2 =
*)
let map f ord a b = ord (f a) (f b)
let (>|=) x f = map f x
module Infix = struct
let (>|=) = (>|=)
let (<?>) = (<?>)
end

View file

@ -58,3 +58,11 @@ val map : ('a -> 'b) -> 'b t -> 'a t
Example:
[map fst CCInt.compare] compares values of type [(int * 'a)] by their
first component. *)
val (>|=) : 'b t -> ('a -> 'b) -> 'a t
(** Infix equivalent of {!map} *)
module Infix : sig
val (<?>) : int -> ('a t * 'a * 'a) -> int
val (>|=) : 'b t -> ('a -> 'b) -> 'a t
end