Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file incr_select_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384openCoremoduletypeS=sigmoduleIncr:sigtype'atend(** [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. *)valselect_one:(moduleHashable.Commonwithtypet='a)->'aIncr.t->('a->boolIncr.t)Staged.t(** [select_one'] is similar to [select_one], except you can decide to not make a choice
(by choosing [None]) *)valselect_one':(moduleHashable.Commonwithtypet='a)->'aoptionIncr.t->('a->boolIncr.t)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)) ]}
*)valselect_one_value:(moduleHashable.Commonwithtypet='a)->default:'b->('a*'b)Incr.t->('a->'bIncr.t)Staged.t(** [select_one_value'] is the same as [select_one_value] except if the input is None,
then all outputs are [default]. *)valselect_one_value':(moduleHashable.Commonwithtypet='a)->default:'b->('a*'b)optionIncr.t->('a->'bIncr.t)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])]}
*)valselect_many:(moduleHashable.Commonwithtypet='a)->'alistIncr.t->('a->boolIncr.t)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.
*)valselect_many_values:(moduleHashable.Commonwithtypet='a)->default:'b->('a*'b)listIncr.t->('a->'bIncr.t)Staged.tendmoduletypeIncr_select=sig(** This module provides the ability to create a large set of incremental outputs based
on a single incremental input, where some subset of the outputs are selected to have
specific values, and the remainder are left with a specified default value. The
outputs are updated in time proportional to the number of outputs that are changed,
independent of the number of outputs that exist. Each function returns a staged
function for allocating new output incrementals.
Note that it's possible that no incremental output is actually instantiated for the
node that is selected, which is not a problem. Also, one can have more than one
incremental that reflects the same output.
An example of where this is useful is for managing focus in a UI, where you want a
single value to determine where the focus is, and many individual incrementals for
determining whether a given sub-component is in focus.
*)moduleMake(Incr:Incremental.S_gen):SwithmoduleIncr:=Incrend