package bonsai

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

Record_builder is the primary way to compose form values using this library.

Example:

type my_type =
  { x : string
  ; y : int
  } [@@deriving fields]


val a : string t
val b : int t

let c: my_type t =
  let open Form.Record_builder in
  build_for_record
    (Fields.make_creator
       ~x:(field a)
       ~y:(field b))

Record_builder is the primary way to compose form values using this library.

Example:

type my_type =
  { x : string
  ; y : int
  } [@@deriving fields]


val a : string t
val b : int t

let c: my_type t =
  let open Form.Record_builder in
  build_for_record
    (Fields.make_creator
       ~x:(field a)
       ~y:(field b))
type ('b, 'a) profunctor
val prj : ('a, 'a) profunctor -> 'a Bonsai_web_ui_form__.Form.t
val inj : 'a Bonsai_web_ui_form__.Form.t -> ('a, 'a) profunctor
module Bare : Record_builder.S2 with type ('b, 'a) applicative = ('b, 'a) profunctor

The underlying applicative record builder, which does not perform the contravariant mapping.

val field : 'field Bonsai_web_ui_form__.Form.t -> ('record, 'field) Base.Field.t -> ('field, _, _, 'record) Bare.Make_creator_types.handle_one_field

Supply the term for one field.

The type of this function is designed to match up with Fields.make_creator (see the example).

val build_for_record : ('record, _, 'record) Bare.Make_creator_types.handle_all_fields -> 'record Bonsai_web_ui_form__.Form.t

Build the overarching profunctor for the whole record.

This takes a partial application of Fields.make_creator as its argument, which should supply no initial value but use field to supply a term for every field of the record.

The type of this is designed to match up with Fields.make_creator (see the example).