Module Search_monad

module Search_monad: sig .. end

Search monad that allows to express non-deterministic algorithms in a legible maner, or programs that solve combinatorial problems.


type 'a m 

A data type that represent a collection of 'a

Monadic operations

val (>>) : 'a m -> ('a -> 'b m) -> 'b m

bind and return

val return : 'a -> 'a m
val (>>|) : 'a m -> 'a m -> 'a m

non-deterministic choice

val fail : unit -> 'a m

failure

val fold : ('a -> 'b -> 'b) -> 'a m -> 'b -> 'b

folding through the collection

Derived facilities

val sprint : ('a -> string) -> 'a m -> string
val count : 'a m -> int
val choose : 'a m -> 'a option
val to_list : 'a m -> 'a list
val sort : ('a -> 'a -> int) -> 'a m -> 'a m
val is_empty : 'a m -> bool
val filter : ('a -> bool) -> 'a m -> 'a m