From 447b60afccc89ef18d8f92a260dd1fcdf735898e Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 31 Aug 2008 08:32:18 -0400 Subject: Laconic -> Ur --- tests/list.ur | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/list.ur (limited to 'tests/list.ur') diff --git a/tests/list.ur b/tests/list.ur new file mode 100644 index 00000000..a4602d0e --- /dev/null +++ b/tests/list.ur @@ -0,0 +1,19 @@ +datatype list a = Nil | Cons of a * list a + +val isNil = fn t ::: Type => fn ls : list t => + case ls of Nil => True | _ => False + +val show = fn b => if b then "True" else "False" + +val rec delist : list string -> xml body [] [] = fn x => + case x of + Nil => Nil + | Cons (h, t) => {cdata h} :: {delist t} + +val main : unit -> page = fn () => + {cdata (show (isNil (Nil : list bool)))}, + {cdata (show (isNil (Cons (1, Nil))))}, + {cdata (show (isNil (Cons ("A", Cons ("B", Nil)))))} + +

{delist (Cons ("X", Cons ("Y", Cons ("Z", Nil))))}

+ -- cgit v1.2.3