Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=af4bf61dc1beb8b5428955bff3a209a3c231fe93eaa02a70cbb13907bb65a85b
sha512=be98fd76da87c1b40452b970c9b9826d5ba16a0629e46f67230b654c8d5b954b12082ecfec68594abf6440fb531599972dc579537c0149801de86cd84f4c99f8
Description
A list that is known, statically, to be nonempty. The hd and tl functions don't require option types, or exceptions, improving safety.
This library follows closely Janestreet's Base library, providing similar complexity and functions to Base.List.
Added to opam-repository:
README
ocaml-non-empty-list
A list that is known, statically, to be nonempty. The hd and tl functions don't require option types, or exceptions, improving safety.
This library follows closely Janestreet's Base library, providing similar complexity and functions to Base.List.
Usage
open Non_empty_list;;
let one = [1];;
val one : int non_empty_list = (::) (1, []) (* [1] *)
let two = cons 2 one;;
val two : int non_empty_list = (::) (2, [1]) (* [2; 1] *)
hd one;;
- : int = 1
append one two;;
- : int non_empty_list = (::) (1, [2; 1]) (* [1; 2; 1] *)
length two;;
- : int = 2
to_list two;;
- : int list = [2; 1]
mem ~equal:( = ) two 2;;
- : bool = true
reduce ~f:( + ) two;;
- : int = 3Testing
dune build
dune runtest
Dependencies (4)
-
ppx_deriving
>= "4.5" -
base
>= "v0.14.1" -
dune
>= "2.8" -
ocaml
>= "4.08.0"
Dev Dependencies (1)
-
alcotest
with-test
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building non_empty_list with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. 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.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.1 (this version) | good | good | good | good | good |
- 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