package incr_select

  1. Overview
  2. Docs

Parameters

Signature

val select_one : (module Core.Hashable.Common with type t = 'a) -> 'a Incr.t -> ('a -> bool Incr.t) Core.Staged.t

select_one logically constructs a set of outputs such that exactly one is selected as true (specifically the one that corresponds to the current value of the input), and the rest are false. The staged function is used for creating incrementals that contain the appropriate output value.

val select_one' : (module Core.Hashable.Common with type t = 'a) -> 'a option Incr.t -> ('a -> bool Incr.t) Core.Staged.t

select_one' is similar to select_one, except you can decide to not make a choice (by choosing None)

val select_one_value : (module Core.Hashable.Common with type t = 'a) -> default:'b -> ('a * 'b) Incr.t -> ('a -> 'b Incr.t) Core.Staged.t

select_one_value is similar to select_one, except you also get to specify the value it will take on instead of only true and false. select_one h input is equivalent to:

select_one_value h ~default:false (let%map x = input in (x, true)) 
val select_one_value' : (module Core.Hashable.Common with type t = 'a) -> default:'b -> ('a * 'b) option Incr.t -> ('a -> 'b Incr.t) Core.Staged.t

select_one_value' is the same as select_one_value except if the input is None, then all outputs are default.

val select_many : (module Core.Hashable.Common with type t = 'a) -> 'a list Incr.t -> ('a -> bool Incr.t) Core.Staged.t

select_many allows you to specify a group of outputs to be selected as true instead of just one. select_one h input is equivalent to:

select_many h (let%map x = input in [x])
val select_many_values : (module Core.Hashable.Common with type t = 'a) -> default:'b -> ('a * 'b) list Incr.t -> ('a -> 'b Incr.t) Core.Staged.t

select_many_values allows you specify a group of outputs to be selected and their corresponding values.

This is the most general of these functions; all the others can be reduced to it.