package incr_dom_widgets

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Provides operations related to lists of forms.

type 'a list_modifier = {
  1. transform : 'elt. 'elt list -> create_new_form:(?init:'a -> unit -> 'elt) -> 'elt list;
}
val modify_list : State.t -> 'a List_id.t -> f:'a list_modifier -> State.t

Modify list with a supplied list_modifier function.

Raises an exception if the resulting list contains duplicated instances of previously existing elements (although duplicating new elements is fine).

val cons : State.t -> ?init:'a -> 'a List_id.t -> State.t

Add one empty form in front of the list

val append : State.t -> ?init:'a -> 'a List_id.t -> State.t

Add one empty form to the end of the list.

val remove_nth : State.t -> 'a List_id.t -> int -> State.t

Remove n-th form from the list. If int is invalid index (i.e. int < 0 or int >= length of the list), the list remains unchanged and no exceptions are raised.