Page
Library
Module
Module type
Parameter
Class
Class type
Source
Seqes.Sigs
SourceSignatures for all the functors exported afterwards. The documentation of this module also introduces some general concepts of the library. It is a recommended reading for all users of the library.
This compilation unit gathers module signatures which are used in the rest of the library. Essentially, the rest of the library provides functors to generate modules with the signatures below.
The Seqes library provides functors to produce specialised variants of the Stdlib.Seq
type where the forcing of an element involves a monad. E.g., considering an I/O cooperative scheduling monad à la Lwt
or Async
, which we denote with the type 'a io
, you can use Seqes to produce the following type
type 'a t = unit -> 'a node io
and 'a node =
| Nil
| Cons of 'a * 'a t
In addition to specialised types, the library's functor produce an assortment of functions to operate on values of this type. The assortment of function is compatible with the Stdlib.Seq
(except for the monad part). See examples/seqseq/seqseq.ml
for a demonstration of this compatibility.
Familiarity with Stdlib.Seq
is assumed.
Different functors require different monads.
This compilation unit gathers module signatures which are used in the rest of the library. Essentially, the rest of the library provides functors to generate modules with the signatures below.
The Seqes library provides functors to produce specialised variants of the Stdlib.Seq
type where the forcing of an element involves a monad. E.g., considering an I/O cooperative scheduling monad à la Lwt
or Async
, which we denote with the type 'a io
, you can use Seqes to produce the following type
type 'a t = unit -> 'a node io
and 'a node =
| Nil
| Cons of 'a * 'a t
In addition to specialised types, the library's functor produce an assortment of functions to operate on values of this type. The assortment of function is compatible with the Stdlib.Seq
(except for the monad part). See examples/seqseq/seqseq.ml
for a demonstration of this compatibility.
Familiarity with Stdlib.Seq
is assumed.
Some monad have two type parameters. E.g., the result monad is over the type ('a, 'e) result
.
The Seqes library offers all the same features over those monads than it does over the single-parameter monads. Accordingly, below are variants of the module signatures from Sigs1
, but for two-parameter monads.
Note that the specialised type of sequence also carries these two parameters:
type ('a, 'e) t = unit -> (('a, 'e) node, 'e) io
and ('a, 'e) node =
| Nil
| Cons of 'a * ('a, 'e) t
See examples/seqres/seqres.ml
for an example of using Seqes for the result monad. See examples/seqlwtres/seqlwtres.ml
for an example of using Seqes for the Lwt+result monad.
Note that the two type parameters of the monad are not treated the same. Seqes only requires a bind for the first parameter but not the second.
val bind : ('a, 'e) t -> ('a -> ('b, 'e) t) -> ('b, 'e) t
Equivalent to Sigs1.SEQMON1TRAVERSORS
but with two type parameters.
Equivalent to Sigs1.SEQMON1TRANSFORMERS
but with two type parameters.
Equivalent to Sigs1.SEQMON1ALL
but with two type parameters.