Skip to content

c-cube/choice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Choice build

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.