summaryrefslogtreecommitdiff
path: root/tests/rpcDD.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-03-08 13:28:21 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-03-08 13:28:21 -0400
commit654a4218e5122728bcd17bf3cc85e575cdd4fbdc (patch)
treed173044f1a717727f3a58f919b0f11778c4bdb52 /tests/rpcDD.ur
parent0c87867a27b7fdf258d304d95b3c2d0841ad905b (diff)
RPC returning a default datatype
Diffstat (limited to 'tests/rpcDD.ur')
-rw-r--r--tests/rpcDD.ur26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/rpcDD.ur b/tests/rpcDD.ur
new file mode 100644
index 00000000..13293b83
--- /dev/null
+++ b/tests/rpcDD.ur
@@ -0,0 +1,26 @@
+datatype list t = Nil | OtherNil | 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/>
+ | OtherNil => <xml>That's impossible!</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