mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-09 12:45:34 -05:00
add {CCList,CCOpt}.Infix modules
This commit is contained in:
parent
5cdf59f30c
commit
903dac110b
4 changed files with 42 additions and 0 deletions
|
|
@ -1081,6 +1081,15 @@ let of_klist l =
|
||||||
in
|
in
|
||||||
direct direct_depth_default_ l
|
direct direct_depth_default_ l
|
||||||
|
|
||||||
|
module Infix = struct
|
||||||
|
let (>|=) = (>|=)
|
||||||
|
let (@) = (@)
|
||||||
|
let (<*>) = (<*>)
|
||||||
|
let (<$>) = (<$>)
|
||||||
|
let (>>=) = (>>=)
|
||||||
|
let (--) = (--)
|
||||||
|
end
|
||||||
|
|
||||||
(** {2 IO} *)
|
(** {2 IO} *)
|
||||||
|
|
||||||
let pp ?(start="[") ?(stop="]") ?(sep=", ") pp_item buf l =
|
let pp ?(start="[") ?(stop="]") ?(sep=", ") pp_item buf l =
|
||||||
|
|
|
||||||
|
|
@ -465,6 +465,21 @@ val of_gen : 'a gen -> 'a t
|
||||||
val to_klist : 'a t -> 'a klist
|
val to_klist : 'a t -> 'a klist
|
||||||
val of_klist : 'a klist -> 'a t
|
val of_klist : 'a klist -> 'a t
|
||||||
|
|
||||||
|
(** {2 Infix Operators}
|
||||||
|
It is convenient to {!open CCList.Infix} to access the infix operators
|
||||||
|
without cluttering the scope too much.
|
||||||
|
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
module Infix : sig
|
||||||
|
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
|
val (@) : 'a t -> 'a t -> 'a t
|
||||||
|
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
|
||||||
|
val (<$>) : ('a -> 'b) -> 'a t -> 'b t
|
||||||
|
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
|
||||||
|
val (--) : int -> int -> int t
|
||||||
|
end
|
||||||
|
|
||||||
(** {2 IO} *)
|
(** {2 IO} *)
|
||||||
|
|
||||||
val pp : ?start:string -> ?stop:string -> ?sep:string ->
|
val pp : ?start:string -> ?stop:string -> ?sep:string ->
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,14 @@ let of_list = function
|
||||||
| x::_ -> Some x
|
| x::_ -> Some x
|
||||||
| [] -> None
|
| [] -> None
|
||||||
|
|
||||||
|
module Infix = struct
|
||||||
|
let (>|=) = (>|=)
|
||||||
|
let (>>=) = (>>=)
|
||||||
|
let (<*>) = (<*>)
|
||||||
|
let (<$>) = (<$>)
|
||||||
|
let (<+>) = (<+>)
|
||||||
|
end
|
||||||
|
|
||||||
type 'a sequence = ('a -> unit) -> unit
|
type 'a sequence = ('a -> unit) -> unit
|
||||||
type 'a gen = unit -> 'a option
|
type 'a gen = unit -> 'a option
|
||||||
type 'a printer = Buffer.t -> 'a -> unit
|
type 'a printer = Buffer.t -> 'a -> unit
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,16 @@ val (<+>) : 'a t -> 'a t -> 'a t
|
||||||
|
|
||||||
val choice : 'a t list -> 'a t
|
val choice : 'a t list -> 'a t
|
||||||
(** [choice] returns the first non-[None] element of the list, or [None] *)
|
(** [choice] returns the first non-[None] element of the list, or [None] *)
|
||||||
|
(** {2 Infix Operators}
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
module Infix : sig
|
||||||
|
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
|
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
|
||||||
|
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
|
||||||
|
val (<$>) : ('a -> 'b) -> 'a t -> 'b t
|
||||||
|
val (<+>) : 'a t -> 'a t -> 'a t
|
||||||
|
end
|
||||||
|
|
||||||
(** {2 Conversion and IO} *)
|
(** {2 Conversion and IO} *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue