From a49b37dbdbba1e6b0d2aa2ff829507fe07e3da09 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 21 Mar 2013 17:03:14 +0100 Subject: [PATCH] added infix operators in the module --- enum.ml | 8 ++++++++ enum.mli | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/enum.ml b/enum.ml index 638d7f82..f481c607 100644 --- a/enum.ml +++ b/enum.ml @@ -769,6 +769,14 @@ let pp ?(start="") ?(stop="") ?(sep=",") ?(horizontal=false) pp_elem formatter e next true; Format.fprintf formatter "%s@]" stop +let (@@) = append + +let (>>=) e f = flatMap f e + +let (--) = int_range + +let (|>) x f = f x + module Infix = struct let (@@) = append diff --git a/enum.mli b/enum.mli index f20f1211..04d166c5 100644 --- a/enum.mli +++ b/enum.mli @@ -265,10 +265,22 @@ val pp : ?start:string -> ?stop:string -> ?sep:string -> ?horizontal:bool -> (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit (** Pretty print an enum *) + +val (@@) : 'a t -> 'a t -> 'a t + +val (>>=) : 'a t -> ('a -> 'b t) -> 'b t + +val (--) : int -> int -> int t + +val (|>) : 'a -> ('a -> 'b) -> 'b + module Infix : sig val (@@) : 'a t -> 'a t -> 'a t + val (>>=) : 'a t -> ('a -> 'b t) -> 'b t + val (--) : int -> int -> int t + val (|>) : 'a -> ('a -> 'b) -> 'b end