Skip to content

Instantly share code, notes, and snippets.

@tatchi
tatchi / counties.json
Created August 23, 2022 08:11 — forked from rusty-key/counties.json
Countries
[
{"label": "Afghanistan", "value": "af",
{"label": "Åland Islands", "value": "ax"},
{"label": "Albania", "value": "al"},
{"label": "Algeria", "value": "dz"},
{"label": "American Samoa", "value": "as"},
{"label": "AndorrA", "value": "ad"},
{"label": "Angola", "value": "ao"},
{"label": "Anguilla", "value": "ai"},
{"label": "Antarctica", "value": "aq"},
@tatchi
tatchi / form.ml
Created March 15, 2022 17:56 — forked from andreypopp/form.ml
type _ t =
| Form_value : 'a -> 'a t
| Form_field : string -> string t
| Form_map : 'a t * ('a -> ('b, string) result) -> 'b t
| Form_both : 'a t * 'b t -> ('a * 'b) t
let value v = Form_value v
let empty = Form_value ()
let field name = Form_field name
let map v f = Form_map (v, f)
type 'a t
(** [a t] represents a form parser which produces a value of type [a]. *)
val field : string -> string t
(** [field name] parses a string typed value for form field [name]. *)
val map : 'a t -> ('a -> ('b, string) result) -> 'b t
(** [map v f] validates [v] with [f]. *)
val both : 'a t -> 'b t -> ('a * 'b) t