summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-03-08 20:34:21 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-03-08 20:34:21 -0400
commitaed3aa32e62846a16da55fc7be4cecba92ed5e2b (patch)
tree8c31380919fec41eaf59c882a30eec7106838f6c /tests
parent5f77fc276c90321dec9e17ec483a1d8b11db3c96 (diff)
Conversion of functions to CPS, to facilitate ServerCall
Diffstat (limited to 'tests')
-rw-r--r--tests/rpcM.ur33
-rw-r--r--tests/rpcM.urp5
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/rpcM.ur b/tests/rpcM.ur
new file mode 100644
index 00000000..4cd4b86b
--- /dev/null
+++ b/tests/rpcM.ur
@@ -0,0 +1,33 @@
+datatype list t = Nil | Cons of t * list t
+
+sequence s
+
+fun main () : transaction page =
+ let
+ fun getIndices srcs =
+ case srcs of
+ Nil => return Nil
+ | Cons (src, srcs') =>
+ i <- nextval s;
+ set src i;
+ ls <- getIndices srcs';
+ return (Cons (i, ls))
+
+ fun show ls =
+ case ls of
+ Nil => <xml/>
+ | Cons (x, ls') => <xml>{[x]}<br/>{show ls'}</xml>
+ in
+ src1 <- source 0;
+ src2 <- source 1;
+ s <- source Nil;
+ return <xml><body>
+ <button value="Get It On!"
+ onclick={ns <- getIndices (Cons (src1, Cons (src2, Nil)));
+ set s ns}/><br/>
+ <br/>
+ #1: <dyn signal={n <- signal src1; return <xml>{[n]}</xml>}/><br/>
+ #2: <dyn signal={n <- signal src2; return <xml>{[n]}</xml>}/><br/>
+ Current: <dyn signal={ns <- signal s; return (show ns)}/>
+ </body></xml>
+ end
diff --git a/tests/rpcM.urp b/tests/rpcM.urp
new file mode 100644
index 00000000..a1eec77d
--- /dev/null
+++ b/tests/rpcM.urp
@@ -0,0 +1,5 @@
+debug
+sql rpcM.sql
+database dbname=rpcm
+
+rpcM