annotate tests/foldm.ur @ 1893:9a1097954188

compileC: Link libraries in the right order This is needed, at least on recent Ubuntu, to fix this linker error when compiling any Ur/Web application: ld: /tmp/webapp.o: undefined reference to symbol 'uw_write' Signed-off-by: Anders Kaseorg <andersk@mit.edu> --- src/compiler.sml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
author Anders Kaseorg <andersk@mit.edu>
date Thu, 21 Nov 2013 14:32:11 -0500
parents 71bafe66dbe1
children
rev   line source
adamc@75 1 con currier = fold (fn nm => fn t => fn acc => t -> acc) {}
adamc@75 2
adamc@75 3 signature S = sig
adamc@75 4 type t
adamc@75 5 val x : t
adamc@75 6
adamc@75 7 con rs :: {Type}
adamc@75 8 val create : currier rs -> t
adamc@75 9 end
adamc@75 10
adamc@75 11 functor Currier (M : sig con rs :: {Type} end) : S where con rs = M.rs = struct
adamc@75 12 val currier : rs :: {Type} -> currier rs =
adamc@75 13 fold [currier] (fn nm :: Name => fn t :: Type => fn rest :: {Type} => fn acc => fn x : t => acc) {}
adamc@75 14
adamc@75 15 type t = currier M.rs
adamc@75 16 val x = currier [M.rs]
adamc@75 17
adamc@75 18 con rs = M.rs
adamc@75 19 val create : t -> t = fn x => x
adamc@75 20 end
adamc@75 21
adamc@75 22 structure ChefsSpecial = Currier(struct
adamc@75 23 con rs = [A = int, B = float]
adamc@75 24 end)
adamc@75 25
adamc@75 26 val main = ChefsSpecial.x