diff options
Diffstat (limited to 'tests/list.ur')
-rw-r--r-- | tests/list.ur | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/list.ur b/tests/list.ur new file mode 100644 index 0000000..472b9ea --- /dev/null +++ b/tests/list.ur @@ -0,0 +1,22 @@ +fun isNil (t ::: Type) (ls : list t) = + case ls of + [] => True + | _ => False + +fun delist (ls : list string) : xbody = + case ls of + [] => <xml>Nil</xml> + | h :: t => <xml>{[h]} :: {delist t}</xml> + +fun callback ls = return <xml><body> + {delist ls} +</body></xml> + +fun main () = return <xml><body> + {[isNil ([] : list bool)]}, + {[isNil (1 :: [])]}, + {[isNil ("A" :: "B" :: [])]} + + <p>{delist ("X" :: "Y" :: "Z" :: [])}</p> + <a link={callback ("A" :: "B" :: [])}>Go!</a> +</body></xml> |