# HG changeset patch # User Adam Chlipala # Date 1216909578 14400 # Node ID 6c14e78feb6dcecf32b2ca1e7dddbcdaa908029c # Parent cc0bc756f66f1789616b9a904de4b9fd31761f7a gformText test diff -r cc0bc756f66f -r 6c14e78feb6d tests/gformText.lac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/gformText.lac Thu Jul 24 10:26:18 2008 -0400 @@ -0,0 +1,50 @@ +con stringify = fold (fn nm :: Name => fn u :: Unit => fn t :: {Type} => [nm = string] ++ t) [] + +signature S = sig + con rs :: {Unit} + val names : $(stringify rs) +end + +signature S' = sig + con rs :: {Unit} + + val handler : $(stringify rs) -> page + val page : unit -> page +end + +functor F (M : S) : S' where con rs = M.rs = struct + con rs = M.rs + + val handler = fn x : $(stringify M.rs) => + {fold [fn rs :: {Unit} => $(stringify rs) -> $(stringify rs) -> xml body [] []] + (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} => + fn f : $(stringify rest) -> $(stringify rest) -> xml body [] [] => + fn names : $(stringify ([nm] ++ rest)) => + fn x : $(stringify ([nm] ++ rest)) => +
  • {cdata names.nm}: {cdata x.nm}
  • {f (names -- nm) (x -- nm)}) + (fn names => fn x => ) + [M.rs] M.names x} + + + val page = fn () => + + {fold [fn rs :: {Unit} => xml lform [] (stringify rs)] + (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} => + fn frag : xml lform [] (stringify rest) => +
  • {useMore frag}
    ) + + [rs]} + + +
    + +end + +structure M = F(struct + con rs = [A, B, C] + + val names = {A = "A", B = "B", C = "C"} +end) + +open M +