blob: d5bd7dbb889fec5d37d09ef9db145ca7dbcf7d7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
fun getOpt (t ::: Type) (o : option t) (v : t) : t =
case o of
None => v
| Some x => x
cookie int : int
cookie float : float
fun main () : transaction page =
n <- getCookie int;
n <- return (getOpt n 7);
sn <- source 6;
f <- getCookie float;
f <- return (getOpt f 1.23);
sf <- source 4.56;
return <xml><body>
<dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/>
<a onclick={set sn n}>CHANGE</a><br/>
<dyn signal={f <- signal sf; return <xml>{[f]}</xml>}/>
<a onclick={set sf f}>CHANGE</a><br/>
</body></xml>
|