package incr_dom_widgets

  1. Overview
  2. Docs

Module to create a form blueprint by taking basic building blocks (like bool or string fields) and combining them into more complex structures which can be themselves combined with other structures.

type ('g, 's, 'ids) t

Describes how to edit a type as a series of form elements.

The two type parameters 's and 'g represent respectively the type that will be edited (set), and the type of the returned edited value (get), so they will be the same when a form is actually used.

The type parameter 'ids represents the different form elements used by the form for editing, and contains (in some tuple structure) all of the ids that should be used for those form elements.

val not_editable : default:'a -> ('a, 'a, unit) t
val bool : (bool, bool, bool Id.t) t
val string : (string, string, string Id.t) t
val sexp : of_sexp:(Core_kernel.Sexp.t -> 'a) -> sexp_of:('a -> Core_kernel.Sexp.t) -> ('a, 'a, string Id.t) t
val variant : 'a list -> equal:('a -> 'a -> bool) -> ('a, 'a, 'a Variant_id.t) t

Raises an exception if the provided list is empty or contains duplicate values.

val both : ('a, 's, 'a_ids) t -> ('b, 's, 'b_ids) t -> ('a * 'b, 's, 'a_ids * 'b_ids) t

Combine two t's.

val map : ('a, 's, 'ids) t -> f:('a -> 'b) -> ('b, 's, 'ids) t
val contra_map : ('g, 'b, 'ids) t -> f:('a -> 'b) -> ('g, 'a, 'ids) t
val conv : ('a, 's, 'ids) t -> f: ('a -> 'ids -> block_id:Block.t Id.t -> ('b, Form_error.t list) Core_kernel.Result.t) -> ('b, 's, Block.t Id.t * 'ids) t

Perform a conversion which also validates the data, and so may have errors.

val conv_without_block : ('a, 's, 'ids) t -> f:('a -> 'ids -> ('b, Form_error.t list) Core_kernel.Result.t) -> ('b, 's, 'ids) t
val list : ('g, 's, 'ids) t -> ('g list, 's list, 'ids list * 's List_id.t) t
module Let_syntax : sig ... end
module Of_record : sig ... end

Build a form for a record directly, in the same manner as Record_builder or Profunctor.

OCaml

Innovation. Community. Security.