Module Incr_dom_widgets.Form.Description.Of_record

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

e.g.

        let animal_form : (Animal.t, Animal.t, string Id.t * (bool Id.t * unit)) t =
          Form.Description.Of_record.build_for_record (
            Animal.Fields.make_creator
              ~species:(field Form.Description.string)
              ~can_quack:(field Form.Description.bool))
        ;;

Is equivalent† to:

        let animal_form : (Animal.t, Animal.t, string Id.t * (bool Id.t * unit)) t =
          let open Form.Description in
          map (
            both (contra_map ~f:Animal.species string) @@
            both (contra_map ~f:Animal.can_quack bool) @@
            Hlist.nil)
            ~f:(fun (species, (can_quack, ())) -> { Animal.species; can_quack; })
        ;;

† except that there is no risk of name shadowing as there would be here, but I wrote the local open only for brevity.

module Make_creator_types : sig ... end

These are the types used for building a form by combining record fields.

val field : ('field'field'field_idst ‑> ('record'fieldCore_kernel.Field.t ‑> ('field'field_ids____'recordMake_creator_types.handle_one_field

Handle one field of a record using the supplied editor.

This should be used as an argument to Fields.make_creator, see the example.

val build_for_record : (_'ids'recordMake_creator_types.handle_all_fields ‑> ('record'record'idst

Build the form for a whole record.

This is used with an application of Fields.make_creator as shown in the example.