diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-08-31 08:32:18 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-08-31 08:32:18 -0400 |
commit | 447b60afccc89ef18d8f92a260dd1fcdf735898e (patch) | |
tree | 93d1ffca9832084286525896afc4c17eaf5d23f4 /tests/list.ur | |
parent | 508290e29047e068b9db4b02485fefd9e3ced81c (diff) |
Laconic -> Ur
Diffstat (limited to 'tests/list.ur')
-rw-r--r-- | tests/list.ur | 19 |
1 files changed, 19 insertions, 0 deletions
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 => <body>Nil</body> + | Cons (h, t) => <body>{cdata h} :: {delist t}</body> + +val main : unit -> page = fn () => <html><body> + {cdata (show (isNil (Nil : list bool)))}, + {cdata (show (isNil (Cons (1, Nil))))}, + {cdata (show (isNil (Cons ("A", Cons ("B", Nil)))))} + + <p>{delist (Cons ("X", Cons ("Y", Cons ("Z", Nil))))}</p> +</body></html> |