package seqes
Build not checkedInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=1b45f9840eb73c2acc1f68741f668ace
sha512=800c26f40e2521485c26d3a9adfa9e59d363db92c5a942dfdb862dccf2a8a8ac5e85f4cbcf21dc99a94958d822cc839b6aa88925e24359ffade97dcf27db98a3
Description
Variations of the Seq module with monads folded into the type
README
Seqes
A library to compose the abstraction of the Stdlib.Seq module with monads.
The Stdlib.Seq module doesn't allow mixing in monads. Specifically, the Stdlib.Seq module provides the following type definition:
type 'a t = unit -> 'a node
and +'a node =
| Nil
| Cons of 'a * 'a tin which an 'a Seq.t must be a simple lambda returning a node. You cannot thread that lambda into a monad.
The Seqes library provides functors to generate new Seq-like modules, adapted to your monad.
Seqes.Standard
The functor Seqes.Standard.Make1 takes a monad parameter.
module SeqM = Seqes.Standard.Make1(Monad)It returns a module containing traversors using the provided Monad.
SeqM.iter : ('a -> unit Monad.t) -> 'a Stdlib.Seq.t -> unit Monad.tCheck examples/seqlwt/seqlwt.ml for an example use of Seqes.Standard.Make1.
Seqes.Monadic.Make1
The functor Seqes.Monadic.Make1 takes a monad parameter.
module SeqM = Seqes.Monadic.Make1(Monad)It returns a module with a fresh type definition integrating the Seq abstraction and the monad together:
type 'a t = unit -> 'a node Monad.t
and 'a node =
| Nil
| Cons of 'a * 'a tIt also exports all the functions from the Stdlib.Seq module but operating on that new type instead.
SeqM.iter : ('a -> unit) -> 'a SeqM.t -> unit Monad.tThe library provides more advance usage. Specifically, note how the SeqM.iter function takes a function 'a -> unit, and how it is sometimes useful to pass a 'a -> unit Monad.t function instead.
The module produce by Seqes.Monadic.Make1 actually contains a submodule M with those specialised variants.
SeqM.M.iter : ('a -> unit Monad.t) -> 'a SeqM.t -> unit Monad.tIn addition to this submodule M, the module contains two functors to generate more specialised sets of functions. See examples/seqlist/ for an example of this even more advanced use.
Seqes.Standard.Make2 and Seqes.Monadic.Make2
If your monad has two type parameters (e.g., ('a, 'e) result), then you can use Seqes.Standard.Make2 and Seqes.Monadic.Make2 instead of the functors mentioned above.
See examples/seqres/seqres.ml and examples/seqlwtres/seqlwtres.ml for examples.
Dev Dependencies (4)
-
odoc
with-doc -
alcotest
with-test & >= "1.5.0" -
qcheck-alcotest
with-test -
qcheck
with-test & >= "0.19"
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building seqes with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
This version is not in the latest run; the versions below are.
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure