summaryrefslogtreecommitdiff
path: root/tests/rpcDO.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-03-08 12:54:07 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-03-08 12:54:07 -0400
commit0c87867a27b7fdf258d304d95b3c2d0841ad905b (patch)
treebfda8c2d7f2e68ec0896c04909dceb281f84f3ec /tests/rpcDO.ur
parentc0a6029c982508efaa1f00caf4b61dc0096443b2 (diff)
RPC returning an option datatype
Diffstat (limited to 'tests/rpcDO.ur')
-rw-r--r--tests/rpcDO.ur25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/rpcDO.ur b/tests/rpcDO.ur
new file mode 100644
index 00000000..4ba6015c
--- /dev/null
+++ b/tests/rpcDO.ur
@@ -0,0 +1,25 @@
+datatype list t = Nil | Cons of t * list t
+
+table t : {A : int}
+
+fun main () : transaction page =
+ let
+ fun rows () =
+ query (SELECT * FROM t)
+ (fn r ls => return (Cons (r.T.A, ls)))
+ Nil
+
+ fun show ls =
+ case ls of
+ Nil => <xml/>
+ | Cons (x, ls') => <xml>{[x]}<br/>{show ls'}</xml>
+ in
+ s <- source Nil;
+ return <xml><body>
+ <button value="Get It On!"
+ onclick={ls <- rows ();
+ set s ls}/><br/>
+ <br/>
+ Current: <dyn signal={ls <- signal s; return (show ls)}/>
+ </body></xml>
+ end