(* Existential type body for our data items *)
con whateverField = fn t :: Type =>
{
Name : text,
(* Display name *)
ToHtml : t -> bodyTags,
(* Output the field value in HTML *)
Input : tab :: NameOpt -> name :: FieldName
-> tagsEnv form (Empty(Type)) [[@@tab.name : t]],
(* Generate a form input tag for a value for this field *)
}
(* Generate the application *)
val metaform = fn fields :: {Exists whateverField} =>
let
val rec main = fn () =>
Whatever-you-feel-like Inventory
Whatever-you-feel-like inventory
Please enter a value for each of the firm's mission-critical assets.
end)
[fields]}
and handler = fn inputs : $fields =>
Whatever-you-feel-like Inventory results
Whatever-you-feel-like inventory results
{fold (fn r :: {Exists whateverField} => bodyTags)
(fn tname :: NameOpt => fn name :: FieldName =>
fn t :: Exists whateverField =>
fn tail :: {Exists whateverField} =>
fn v : t =>
fn acc : bodyTags =>
unpack v as v2 : t2 with vr in
:
{#ToHtml vr v2}
{acc}
end)
[fields] inputs}
Try again?
in
main
end