Skip to content

Instantly share code, notes, and snippets.

@fakenickels
Last active December 2, 2018 11:38
Show Gist options
  • Save fakenickels/57a643ffbd5d23bb22456307a5d55a5f to your computer and use it in GitHub Desktop.
Save fakenickels/57a643ffbd5d23bb22456307a5d55a5f to your computer and use it in GitHub Desktop.
[{pstr_desc =
Pstr_module
{pmb_name = {txt = "FormConfig"};
pmb_expr =
{pmod_desc =
Pmod_structure
[{pstr_desc =
Pstr_type
[{ptype_name = {txt = "field"};
ptype_params = [({ptyp_desc = Ptyp_any}, Invariant)];
ptype_cstrs = [];
ptype_kind =
Ptype_variant
[{pcd_name = {txt = "Email"}; pcd_args = [];
pcd_res =
Some
{ptyp_desc =
Ptyp_constr ({txt = Lident "field"},
[{ptyp_desc =
Ptyp_constr ({txt = Lident "string"}, [])}])}};
{pcd_name = {txt = "Age"}; pcd_args = [];
pcd_res =
Some
{ptyp_desc =
Ptyp_constr ({txt = Lident "field"},
[{ptyp_desc = Ptyp_constr ({txt = Lident "int"}, [])}])}}];
ptype_private = Public; ptype_manifest = None}]};
{pstr_desc =
Pstr_type
[{ptype_name = {txt = "state"}; ptype_params = [];
ptype_cstrs = [];
ptype_kind =
Ptype_record
[{pld_name = {txt = "email"}; pld_mutable = Immutable;
pld_type =
{ptyp_desc = Ptyp_constr ({txt = Lident "string"}, [])}};
{pld_name = {txt = "age"}; pld_mutable = Immutable;
pld_type =
{ptyp_desc = Ptyp_constr ({txt = Lident "int"}, [])}}];
ptype_private = Public; ptype_manifest = None}]};
{pstr_desc =
Pstr_value (Nonrecursive,
[{pvb_pat =
{ppat_desc =
Ppat_constraint ({ppat_desc = Ppat_var {txt = "get"}},
{ptyp_desc =
Ptyp_poly (["value"],
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "state"}, [])},
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "field"},
[{ptyp_desc = Ptyp_var "value"}])},
{ptyp_desc = Ptyp_var "value"})})})})};
pvb_expr =
{pexp_desc =
Pexp_newtype ("value",
{pexp_desc =
Pexp_constraint
({pexp_desc =
Pexp_fun ("", None,
{ppat_desc = Ppat_var {txt = "state"}},
{pexp_desc =
Pexp_fun ("", None,
{ppat_desc = Ppat_var {txt = "field"}},
{pexp_desc =
Pexp_match
({pexp_desc =
Pexp_ident {txt = Lident "field"}},
[{pc_lhs =
{ppat_desc =
Ppat_construct ({txt = Lident "Email"},
None)};
pc_guard = None;
pc_rhs =
{pexp_desc =
Pexp_field
({pexp_desc =
Pexp_ident {txt = Lident "state"}},
{txt = Lident "email"})}};
{pc_lhs =
{ppat_desc =
Ppat_construct ({txt = Lident "Age"},
None)};
pc_guard = None;
pc_rhs =
{pexp_desc =
Pexp_field
({pexp_desc =
Pexp_ident {txt = Lident "state"}},
{txt = Lident "age"})}}])})})},
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "state"}, [])},
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "field"},
[{ptyp_desc =
Ptyp_constr ({txt = Lident "value"}, [])}])},
{ptyp_desc =
Ptyp_constr ({txt = Lident "value"}, [])})})})})}}])};
{pstr_desc =
Pstr_value (Nonrecursive,
[{pvb_pat =
{ppat_desc =
Ppat_constraint ({ppat_desc = Ppat_var {txt = "set"}},
{ptyp_desc =
Ptyp_poly (["value"],
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "state"}, [])},
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "field"},
[{ptyp_desc = Ptyp_var "value"}])},
{ptyp_desc =
Ptyp_arrow ("", {ptyp_desc = Ptyp_var "value"},
{ptyp_desc =
Ptyp_constr ({txt = Lident "state"}, [])})})})})})};
pvb_expr =
{pexp_desc =
Pexp_newtype ("value",
{pexp_desc =
Pexp_constraint
({pexp_desc =
Pexp_fun ("", None,
{ppat_desc = Ppat_var {txt = "state"}},
{pexp_desc =
Pexp_fun ("", None,
{ppat_desc = Ppat_var {txt = "field"}},
{pexp_desc =
Pexp_fun ("", None,
{ppat_desc = Ppat_var {txt = "value"}},
{pexp_desc =
Pexp_match
({pexp_desc =
Pexp_ident {txt = Lident "field"}},
[{pc_lhs =
{ppat_desc =
Ppat_construct
({txt = Lident "Email"}, None)};
pc_guard = None;
pc_rhs =
{pexp_desc =
Pexp_record
([({txt = Lident "email"},
{pexp_desc =
Pexp_ident
{txt = Lident "value"}})],
Some
{pexp_desc =
Pexp_ident {txt = Lident "state"}})}};
{pc_lhs =
{ppat_desc =
Ppat_construct ({txt = Lident "Age"},
None)};
pc_guard = None;
pc_rhs =
{pexp_desc =
Pexp_record
([({txt = Lident "age"},
{pexp_desc =
Pexp_ident
{txt = Lident "value"}})],
Some
{pexp_desc =
Pexp_ident {txt = Lident "state"}})}}])})})})},
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "state"}, [])},
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "field"},
[{ptyp_desc =
Ptyp_constr ({txt = Lident "value"}, [])}])},
{ptyp_desc =
Ptyp_arrow ("",
{ptyp_desc =
Ptyp_constr ({txt = Lident "value"}, [])},
{ptyp_desc =
Ptyp_constr ({txt = Lident "state"}, [])})})})})})}}])}]}}}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment