annotate tests/rpc2.ur @ 1183:9d3ccb8b39ac

safeGet
author Adam Chlipala <adamc@hcoop.net>
date Tue, 09 Mar 2010 18:28:44 -0500
parents c5991cdb0c4b
children
rev   line source
adamc@613 1 sequence s
adamc@613 2 sequence s2
adamc@613 3
adamc@613 4 fun dint src = n <- signal src; return <xml>{[n]}</xml>
adamc@613 5
adamc@613 6 fun main () : transaction page =
adamc@613 7 let
adamc@613 8 fun getNext () =
adamc@613 9 n <- nextval s;
adamc@613 10 n2 <- nextval s2;
adamc@613 11 return (n, n2)
adamc@613 12 in
adamc@613 13 src1 <- source 0;
adamc@613 14 src2 <- source 0;
adamc@613 15 return <xml><body>
adamc@613 16 <button value="Get It On!"
adamc@613 17 onclick={p <- getNext ();
adamc@613 18 case p of
adamc@613 19 (n1, n2) => set src1 n1;
adamc@613 20 set src2 n2}/>
adamc@613 21 <br/>
adamc@613 22 Current1: <dyn signal={dint src1}/>
adamc@613 23 Current2: <dyn signal={dint src2}/>
adamc@613 24 </body></xml>
adamc@613 25 end