mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 11:15:32 -05:00
infix operators in Sequence.Infix
This commit is contained in:
parent
b109e99c00
commit
ba3564c2bb
2 changed files with 21 additions and 0 deletions
11
sequence.ml
11
sequence.ml
|
|
@ -582,6 +582,17 @@ module TypeClass = struct
|
||||||
fold addable.add addable.empty seq
|
fold addable.add addable.empty seq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
(** {2 Infix functions} *)
|
||||||
|
|
||||||
|
module Infix = struct
|
||||||
|
let (--) i j = int_range ~start:i ~stop:j
|
||||||
|
|
||||||
|
let (|>) x f = f x
|
||||||
|
|
||||||
|
let (@@) a b = append a b
|
||||||
|
|
||||||
|
let (>>=) x f = flatMap f x
|
||||||
|
end
|
||||||
|
|
||||||
(** {2 Pretty printing of sequences} *)
|
(** {2 Pretty printing of sequences} *)
|
||||||
|
|
||||||
|
|
|
||||||
10
sequence.mli
10
sequence.mli
|
|
@ -319,6 +319,16 @@ module TypeClass : sig
|
||||||
val to_addable : ('a,'b) addable -> 'a t -> 'b
|
val to_addable : ('a,'b) addable -> 'a t -> 'b
|
||||||
end
|
end
|
||||||
|
|
||||||
|
(** {2 Infix functions} *)
|
||||||
|
|
||||||
|
module Infix : sig
|
||||||
|
val (--) : int -> int -> int t
|
||||||
|
|
||||||
|
val (|>) : 'a -> ('a -> 'b) -> 'b
|
||||||
|
|
||||||
|
val (@@) : 'a t -> 'a t -> 'a t
|
||||||
|
end
|
||||||
|
|
||||||
(** {2 Pretty printing of sequences} *)
|
(** {2 Pretty printing of sequences} *)
|
||||||
|
|
||||||
val pp_seq : ?sep:string -> (Format.formatter -> 'a -> unit) ->
|
val pp_seq : ?sep:string -> (Format.formatter -> 'a -> unit) ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue