package choice

  1. Overview
  2. Docs
Choice monad, for easy backtracking

Install

Dune Dependency

Authors

Maintainers

Sources

v0.4.tar.gz
md5=90f12307c085deba053997bded3a4b84
sha512=9078b75ba63ae5afcbea80e7b9838c721b69e95190f787f399e18dfbd39735abdf0c8b22cfae34c6801475f542d530bee5f0665284c4df9a4b14c4fb638a3188

README.md.html

Choice

Choice monad. See the Haskell library or this paper

See online documentation.

Example

> #require "choice";;
> open Choice.Infix;;
> let c = Choice.lift2 (fun x y -> x,y)
  (Choice.of_list [1;2;3;4]) (Choice.of_list ["1"; "3"]);;
val c : (int * string) Choice.t = <abstr>
> let c2 = Choice.filter c (fun (x,y) -> x = int_of_string y);;
val c2 : (int * string) Choice.t = <abstr>
> let c3 = Choice.take 2 c2;;
val c3 : (int * string) Choice.t = <abstr>
> Choice.run_n 4 c3;;
- : (int * string) list = [(3, "3"); (1, "1")]

Build

You need OCaml >= 4.03.0 and dune.

$ make
$ make install

License

The code is free, released under the BSD-2 license.

OCaml

Innovation. Community. Security.