(* 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.
{fold con (fn r :: {Exists whateverField} => tagsEnv form (Empty(Type)) r) (fn tname :: NameOpt => fn name :: FieldName => fn t :: Exists whateverField => fn tail :: {Exists whateverField} => fn acc : (tagsEnv form (Empty(Type)) tail) => unpack con t as t2 with vr in : {#Input vr [tname] [name]}
{acc} 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