diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-09-11 09:36:47 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-09-11 09:36:47 -0400 |
commit | 7bc788c67ed9331773355ceeae4ace7923a6e914 (patch) | |
tree | 94beda93e06e4418c5d001aa317365a1d878efdb /tests | |
parent | 9e804908dd69043c8a9942cdf6042b8dc0d76175 (diff) |
Unpoly non-recursive function
Diffstat (limited to 'tests')
-rw-r--r-- | tests/specialize.ur | 26 | ||||
-rw-r--r-- | tests/specialize.urp | 6 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/specialize.ur b/tests/specialize.ur new file mode 100644 index 00000000..532463c0 --- /dev/null +++ b/tests/specialize.ur @@ -0,0 +1,26 @@ +datatype list a = Nil | Cons of a * list a + +fun isNil (t ::: Type) (ls : list t) : bool = + case ls of + Nil => True + | Cons _ => False + +(*fun append (t ::: Type) (ls1 : list t) (ls2 : list t) : list t = + case ls1 of + Nil => ls2 + | Cons (x, ls1') => Cons (x, append ls1' ls2) + +fun delist (ls : list string) : xml body [] [] = + case ls of + Nil => <body>Nil</body> + | Cons (h, t) => <body>{cdata h} :: {delist t}</body>*) + +val ls = Cons ("X", Cons ("Y", Cons ("Z", Nil))) + +fun main () : transaction page = return <html><body> + {if isNil ls then <body>It's Nil.</body> else <body>It's not Nil.</body>} +</body></html> + + +(* <p>{delist ls}</p>*) + diff --git a/tests/specialize.urp b/tests/specialize.urp new file mode 100644 index 00000000..a3f67c27 --- /dev/null +++ b/tests/specialize.urp @@ -0,0 +1,6 @@ +debug +database dbname=test +exe /tmp/webapp + +specialize + |