adamc@146: con stringify = fold (fn nm :: Name => fn u :: Unit => fn t :: {Type} => [nm = string] ++ t) [] adamc@146: adamc@146: signature S = sig adamc@146: con rs :: {Unit} adamc@146: end adamc@146: adamc@146: signature S' = sig adamc@146: con rs :: {Unit} adamc@146: adamc@146: val handler : $(stringify rs) -> page adamc@146: val page : unit -> page adamc@146: end adamc@146: adamc@146: functor F (M : S) : S' where con rs = M.rs = struct adamc@146: con rs = M.rs adamc@146: adamc@146: val handler = fn x : $(stringify M.rs) => adamc@146: OK. adamc@146: adamc@146: adamc@146: val page = fn () => adamc@147: adamc@147: {fold [fn rs :: {Unit} => xml lform [] (stringify rs)] adamc@147: (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} => adamc@147: fn frag : xml lform [] (stringify rest) => adamc@147:
  • {frag}
  • ) adamc@147: adamc@147: [rs]} adamc@146: adamc@147: adamc@147:
    adamc@146: adamc@146: end adamc@146: adamc@146: structure M = F(struct adamc@147: con rs = [A, B, C] adamc@146: end) adamc@146: adamc@146: open M adamc@146: