adamc@75: con currier = fold (fn nm => fn t => fn acc => t -> acc) {} adamc@75: adamc@75: signature S = sig adamc@75: type t adamc@75: val x : t adamc@75: adamc@75: con rs :: {Type} adamc@75: val create : currier rs -> t adamc@75: end adamc@75: adamc@75: functor Currier (M : sig con rs :: {Type} end) : S where con rs = M.rs = struct adamc@75: val currier : rs :: {Type} -> currier rs = adamc@75: fold [currier] (fn nm :: Name => fn t :: Type => fn rest :: {Type} => fn acc => fn x : t => acc) {} adamc@75: adamc@75: type t = currier M.rs adamc@75: val x = currier [M.rs] adamc@75: adamc@75: con rs = M.rs adamc@75: val create : t -> t = fn x => x adamc@75: end adamc@75: adamc@75: structure ChefsSpecial = Currier(struct adamc@75: con rs = [A = int, B = float] adamc@75: end) adamc@75: adamc@75: val main = ChefsSpecial.x