package seqes

  1. Overview
  2. Docs

The module type for the output of the Make module (below).

type 'a mon

The type of the monad that the specialised Seq variation is built upon. This type is destructively substituted by the application of the functor; it is replaced by the actual monad type passed as parameter.

type 'a t = unit -> 'a node mon

The Seq-like type: identical to Stdlib.Seq.t except for mon.

and 'a node =
  1. | Nil
  2. | Cons of 'a * 'a t

This include brings all the functions from the Stdlib.Seq module but specialised to the specialised Seq variation. E.g., given module SeqMon = Make(Mon) then the function SeqMon.map has type ('a -> 'b) -> 'a t -> 'b t and SeqMon.iter has type ('a -> unit) -> 'a t -> unit mon.

See the documentation of Sigs1.SEQMON1ALL for more details.

Any monad that we can use to produce transformers, we can also use to produce traversors. Thus, SEQMON1TRANSFORMERS includes SEQMON1TRAVERSORS and all the functors producing transformer also produce traversors.

val iter : ('a -> unit) -> 'a t -> unit mon
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a mon
val iteri : (int -> 'a -> unit) -> 'a t -> unit mon
val fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b mon
val for_all : ('a -> bool) -> 'a t -> bool mon
val exists : ('a -> bool) -> 'a t -> bool mon
val find : ('a -> bool) -> 'a t -> 'a option mon
val find_map : ('a -> 'b option) -> 'a t -> 'b option mon
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit mon
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b t -> 'c t -> 'a mon
val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool mon
val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool mon
val init : int -> (int -> 'a) -> 'a t
val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t
val forever : (unit -> 'a) -> 'a t
val iterate : ('a -> 'a) -> 'a -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val filter : ('a -> bool) -> 'a t -> 'a t
val filter_map : ('a -> 'b option) -> 'a t -> 'b t
val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t
val take_while : ('a -> bool) -> 'a t -> 'a t
val drop_while : ('a -> bool) -> 'a t -> 'a t
val group : ('a -> 'a -> bool) -> 'a t -> 'a t t
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> 'b t * 'c t
val partition : ('a -> bool) -> 'a t -> 'a t * 'a t
val is_empty : 'a t -> bool mon
val uncons : 'a t -> ('a * 'a t) option mon
val length : 'a t -> int mon
val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool mon
val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int mon
val empty : 'a t
val return : 'a -> 'a t
val cons : 'a -> 'a t -> 'a t
val repeat : 'a -> 'a t
val cycle : 'a t -> 'a t
val take : int -> 'a t -> 'a t
val drop : int -> 'a t -> 'a t
val memoize : 'a t -> 'a t
val once : 'a t -> 'a t
val transpose : 'a t t -> 'a t t
val append : 'a t -> 'a t -> 'a t
val concat : 'a t t -> 'a t
val flat_map : ('a -> 'b t) -> 'a t -> 'b t
val concat_map : ('a -> 'b t) -> 'a t -> 'b t
val zip : 'a t -> 'b t -> ('a * 'b) t
val interleave : 'a t -> 'a t -> 'a t
val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t
val product : 'a t -> 'b t -> ('a * 'b) t
val unzip : ('a * 'b) t -> 'a t * 'b t
val split : ('a * 'b) t -> 'a t * 'b t
val of_dispenser : (unit -> 'a option mon) -> 'a t
val to_dispenser : 'a t -> unit -> 'a option mon
val ints : int -> int t
val of_seq : 'a Seq.t -> 'a t

See Stdlib.Seq.of_seq

module M : sig ... end

M is a module which contains a specialised subset of the functions from the Stdlib.Seq module. Specifically, it contains those functions which take a function as parameter (e.g., map but not length). Moreover, those parameter functions' return type is specialised to be within the mon monad. E.g., given module SeqMon = Make(Mon) then SeqMon.M.map has type ('a -> 'b Mon.t) -> 'a t -> 'b t and SeqMon.M.iter has type ('a -> unit mon) -> 'a t -> unit mon.

module Make (Alt : sig ... end) (Glue : sig ... end) : sig ... end

Make is a functor to produce further M-like modules, but with parameter functions returning into a different monad. E.g., given module SeqMon = Make(Mon) and module SeqMonMun = SeqMon.Make(Mun) then SeqMonMun.map has type ('a -> 'b Mun.t) -> 'a t -> 'b t.

module MakeTraversors (Alt : sig ... end) (Ret : sig ... end) (GlueAlt : sig ... end) (GlueMon : sig ... end) : sig ... end

MakeTraversors is a functor similar to Make. It produces only a subset of the functions that Make does. Specifically, it produces the subset of functions that traverse a sequence (or part thereof) and return a value which is not a sequence (e.g., iter returning unit but not map returning a new sequence).

OCaml

Innovation. Community. Security.