Reference
Auto-generated API reference from nix-effects source.

Choice

Non-deterministic choice effect: choose/fail/guard with list handler.

choose

Non-deterministic choice from a list of alternatives. The handler determines how alternatives are explored.

choose : [a] -> Computation a

fail

Fail the current branch of non-deterministic computation. Equivalent to choose [].

fail : Computation a

guard

Guard a condition: continue if true, fail if false.

guard : bool -> Computation null

initialState

Initial state for the listAll handler.

listAll

Handler that explores all non-deterministic branches and returns a list of all results. Empty choices abort that branch.

State is { results : [a], pending : [Computation a] }. After handling, results are in state.results.

let r = handle { handlers = choice.listAll; state = choice.initialState; } comp;
in r.state.results