package seqes

  1. Overview
  2. Docs

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.

See the documentation of Sigs1.SEQMON1TRANSFORMERS 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 Mon.t) -> 'a t -> unit Mon.t
val fold_left : ('a -> 'b -> 'a Mon.t) -> 'a -> 'b t -> 'a Mon.t
val iteri : (int -> 'a -> unit Mon.t) -> 'a t -> unit Mon.t
val fold_lefti : ('b -> int -> 'a -> 'b Mon.t) -> 'b -> 'a t -> 'b Mon.t
val for_all : ('a -> bool Mon.t) -> 'a t -> bool Mon.t
val exists : ('a -> bool Mon.t) -> 'a t -> bool Mon.t
val find : ('a -> bool Mon.t) -> 'a t -> 'a option Mon.t
val find_map : ('a -> 'b option Mon.t) -> 'a t -> 'b option Mon.t
val iter2 : ('a -> 'b -> unit Mon.t) -> 'a t -> 'b t -> unit Mon.t
val fold_left2 : ('a -> 'b -> 'c -> 'a Mon.t) -> 'a -> 'b t -> 'c t -> 'a Mon.t
val for_all2 : ('a -> 'b -> bool Mon.t) -> 'a t -> 'b t -> bool Mon.t
val exists2 : ('a -> 'b -> bool Mon.t) -> 'a t -> 'b t -> bool Mon.t
val init : int -> (int -> 'a Mon.t) -> 'a t
val unfold : ('b -> ('a * 'b) option Mon.t) -> 'b -> 'a t
val forever : (unit -> 'a Mon.t) -> 'a t
val iterate : ('a -> 'a Mon.t) -> 'a -> 'a t
val map : ('a -> 'b Mon.t) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b Mon.t) -> 'a t -> 'b t
val filter : ('a -> bool Mon.t) -> 'a t -> 'a t
val filter_map : ('a -> 'b option Mon.t) -> 'a t -> 'b t
val scan : ('b -> 'a -> 'b Mon.t) -> 'b -> 'a t -> 'b t
val take_while : ('a -> bool Mon.t) -> 'a t -> 'a t
val drop_while : ('a -> bool Mon.t) -> 'a t -> 'a t
val group : ('a -> 'a -> bool Mon.t) -> 'a t -> 'a t t
val map2 : ('a -> 'b -> 'c Mon.t) -> 'a t -> 'b t -> 'c t
val map_product : ('a -> 'b -> 'c Mon.t) -> 'a t -> 'b t -> 'c t
val partition_map : ('a -> ('b, 'c) Either.t Mon.t) -> 'a t -> 'b t * 'c t
val partition : ('a -> bool Mon.t) -> 'a t -> 'a t * 'a t