Module Form.Field

Allows creating a list of form fields using normal list syntax with a local open (e.g. Field.[bool("remember-me"), string("username")]

type 'a t

A form field is a field name and a decoder function for the field.

type (_, _) list =
| [] : ('a'a) list
| :: : 'a t * ('b'c) list -> ('a -> 'b'c) list

Used to create a form field list.

val bool : string -> bool t

bool(name) returns a boolean field named name.

val ensure : ('a -> bool) -> 'a t -> 'a t

ensure(pred, field) returns a field that will succeed decoding a value a of type 'a if pred(a) is true. Otherwise it will fail decoding.

val float : string -> float t

float(name) returns a float field named name.

val int : string -> int t

int(name) returns an integer field named name.

val make : string -> 'a decoder -> 'a t

make(name, decoder) returns a field with a decoder of type 'a.

val string : string -> string t

string(name) returns a string field named name.