diff options
Diffstat (limited to 'lib/model/field.ml')
| -rw-r--r-- | lib/model/field.ml | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/model/field.ml b/lib/model/field.ml index feb712d..241a9df 100644 --- a/lib/model/field.ml +++ b/lib/model/field.ml @@ -2,11 +2,11 @@ type textI18n = (string * string) list (** A label is just an association list*) type validation = { rule : string list Dsl.t; message : textI18n } -type 't field_ex = T : ('db, 'ocaml, 't) Typ.t -> 't field_ex +type 't field_ex = T : ('db, 'ocaml, 't) Types.t -> 't field_ex type 't t = | F : { - named : ('db, 'ocaml, 't) Typ.t Typ.named; + named : ('db, 'ocaml, 't) Types.t Types.named; (** Name and type of the field, tied together *) label : textI18n; placeholder : textI18n option; @@ -21,11 +21,11 @@ type 't t = ['a] — this is what lets {!named_of} re-stamp it with a known type. The type stays abstract in the interface. *) -let name : 'ref t -> Identifier.t = fun (F f) -> Typ.name f.named +let name : 'ref t -> Identifier.t = fun (F f) -> Types.name f.named let label : 'ref t -> textI18n = fun (F f) -> f.label let placeholder : 'ref t -> textI18n option = fun (F f) -> f.placeholder let icon : 'ref t -> unit option = fun (F f) -> f.icon -let type_ : 'ref t -> 'ref field_ex = fun (F f) -> T (Typ.typ f.named) +let type_ : 'ref t -> 'ref field_ex = fun (F f) -> T (Types.typ f.named) let required : 'ref t -> bool = fun (F f) -> f.required let validation : 'ref t -> validation list = fun (F f) -> f.validation let criteria : 'ref t -> string list Dsl.t option = fun (F f) -> f.criteria @@ -44,7 +44,7 @@ let create : ?criteria name -> F { - named = Typ.named ~name ~typ; + named = Types.named ~name ~typ; label; placeholder; icon; @@ -54,11 +54,13 @@ let create : } let named_of : type db ocaml ref. - ref t -> (db, ocaml, ref) Typ.t -> ((db, ocaml, ref) Typ.t) Typ.named option = + ref t -> + (db, ocaml, ref) Types.t -> + (db, ocaml, ref) Types.t Types.named option = fun (F f) typ -> - match Typ.eq typ f.named.typ with + match Types.eq typ f.named.typ with | None -> None | Some Type.Equal -> ( - match Typ.eq_ocaml typ f.named.typ with + match Types.eq_ocaml typ f.named.typ with | None -> None | Some Type.Equal -> Some f.named) |
