summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 15:58:55 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 15:58:55 -0400
commit6578fad1ed0871839d4b99a40cd626d4f39bf162 (patch)
treef4112230acc95c284530da52a823ff9b88516349 /tests
parent3c78af90b54d01c97ab75fd7290281dfb96921ee (diff)
First Unnest tests working
Diffstat (limited to 'tests')
-rw-r--r--tests/nest.ur41
-rw-r--r--tests/nest.urp3
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/nest.ur b/tests/nest.ur
new file mode 100644
index 00000000..c136b1e6
--- /dev/null
+++ b/tests/nest.ur
@@ -0,0 +1,41 @@
+fun add x =
+ let
+ fun add' y = x + y
+ in
+ add' 1 + add' 2
+ end
+
+fun f (x : int) =
+ let
+ fun page () = return <xml><body>
+ <a link={page ()}>{[x]}</a>
+ </body></xml>
+ in
+ page
+ end
+
+fun f (x : int) =
+ let
+ fun page1 () = return <xml><body>
+ <a link={page2 ()}>{[x]}</a>
+ </body></xml>
+
+ and page2 () =
+ case Some True of
+ Some r => return <xml><body><a link={page1 ()}>{[r]}</a></body></xml>
+ | _ => return <xml>Error</xml>
+ in
+ page1
+ end
+
+datatype list t = Nil | Cons of t * list t
+
+fun length (t ::: Type) (ls : list t) =
+ let
+ fun length' ls acc =
+ case ls of
+ Nil => acc
+ | Cons (_, ls') => length' ls' (acc + 1)
+ in
+ length' ls 0
+ end
diff --git a/tests/nest.urp b/tests/nest.urp
new file mode 100644
index 00000000..7f8a473a
--- /dev/null
+++ b/tests/nest.urp
@@ -0,0 +1,3 @@
+debug
+
+nest