comparison tests/stypes.ur @ 586:1c969230ee7f

Reactive bool
author Adam Chlipala <adamc@hcoop.net>
date Thu, 01 Jan 2009 11:13:08 -0500
parents 35471f067980
children 4c899701bd28
comparison
equal deleted inserted replaced
585:35471f067980 586:1c969230ee7f
2 sInt <- source 0; 2 sInt <- source 0;
3 sFloat <- source 1.23; 3 sFloat <- source 1.23;
4 sBoth <- source (7, 42.1); 4 sBoth <- source (7, 42.1);
5 5
6 sOpt <- source None; 6 sOpt <- source None;
7 sBool <- source True;
7 8
8 return <xml><body> 9 return <xml><body>
9 <dyn signal={n <- signal sInt; return <xml>{[n + 3]}</xml>}/> <a onclick={set sInt 1}>Change</a><br/> 10 <dyn signal={n <- signal sInt; return <xml>{[n + 3]}</xml>}/> <a onclick={set sInt 1}>Change</a><br/>
10 11
11 <dyn signal={n <- signal sFloat; return <xml>{[n + 1.0]}</xml>}/> <a onclick={set sFloat 4.56}>Change</a><br/> 12 <dyn signal={n <- signal sFloat; return <xml>{[n + 1.0]}</xml>}/> <a onclick={set sFloat 4.56}>Change</a><br/>
18 19
19 <dyn signal={o <- signal sOpt; case o of 20 <dyn signal={o <- signal sOpt; case o of
20 None => return <xml>None</xml> 21 None => return <xml>None</xml>
21 | Some n => return <xml>{[n]}</xml>}/> 22 | Some n => return <xml>{[n]}</xml>}/>
22 <a onclick={set sOpt (Some 7)}>Change</a><br/> 23 <a onclick={set sOpt (Some 7)}>Change</a><br/>
24
25 <dyn signal={b <- signal sBool; return <xml>{[b]}</xml>}/> <a onclick={set sBool False}>Change</a><br/>
23 </body></xml> 26 </body></xml>