summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-07-21 10:12:35 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-07-21 10:12:35 -0400
commitda2141fbf28e6173f587ee146acc8f78b7ea8e0d (patch)
tree69937e8dd046f5e3b3ea38f66061cdc8310351bc /demo
parent3e838a5bf95222adb9add226aa3732c3c28633bc (diff)
Update demo code for key/mouse handler change
Diffstat (limited to 'demo')
-rw-r--r--demo/alert.ur2
-rw-r--r--demo/batch.ur8
-rw-r--r--demo/batchFun.ur8
-rw-r--r--demo/chat.ur2
-rw-r--r--demo/increment.ur2
-rw-r--r--demo/listEdit.ur4
-rw-r--r--demo/more/dragList.ur20
-rw-r--r--demo/more/grid.ur22
-rw-r--r--demo/more/versioned1.ur38
-rw-r--r--demo/noisy.ur6
-rw-r--r--demo/react.ur2
11 files changed, 57 insertions, 57 deletions
diff --git a/demo/alert.ur b/demo/alert.ur
index 0f82e4bb..dcd8c202 100644
--- a/demo/alert.ur
+++ b/demo/alert.ur
@@ -1,3 +1,3 @@
fun main () = return <xml><body>
- <button value="Click me!" onclick={alert "You clicked me!"}/>
+ <button value="Click me!" onclick={fn _ => alert "You clicked me!"}/>
</body></xml>
diff --git a/demo/batch.ur b/demo/batch.ur
index 8213dd81..74a5346a 100644
--- a/demo/batch.ur
+++ b/demo/batch.ur
@@ -25,7 +25,7 @@ fun show withDel lss =
Nil => <xml/>
| Cons ((id, a), ls) => <xml>
<tr><td>{[id]}</td> <td>{[a]}</td> {if withDel then
- <xml><td><button value="Delete" onclick={rpc (del id)}/>
+ <xml><td><button value="Delete" onclick={fn _ => rpc (del id)}/>
</td></xml>
else
<xml/>} </tr>
@@ -64,7 +64,7 @@ fun main () =
{show True lss}
- <button value="Update" onclick={ls <- rpc (allRows ()); set lss ls}/><br/>
+ <button value="Update" onclick={fn _ => ls <- rpc (allRows ()); set lss ls}/><br/>
<br/>
<h2>Batch new rows to add</h2>
@@ -72,11 +72,11 @@ fun main () =
<table>
<tr> <th>Id:</th> <td><ctextbox source={id}/></td> </tr>
<tr> <th>A:</th> <td><ctextbox source={a}/></td> </tr>
- <tr> <th/> <td><button value="Batch it" onclick={add ()}/></td> </tr>
+ <tr> <th/> <td><button value="Batch it" onclick={fn _ => add ()}/></td> </tr>
</table>
<h2>Already batched:</h2>
{show False batched}
- <button value="Execute" onclick={exec ()}/>
+ <button value="Execute" onclick={fn _ => exec ()}/>
</body></xml>
end
diff --git a/demo/batchFun.ur b/demo/batchFun.ur
index d69d68af..2147868c 100644
--- a/demo/batchFun.ur
+++ b/demo/batchFun.ur
@@ -75,7 +75,7 @@ functor Make(M : sig
<xml><td>{m.Show v}</td></xml>)
M.fl M.cols (r -- #Id)}
{if withDel then
- <xml><td><button value="Delete" onclick={rpc (del r.Id)}/></td></xml>
+ <xml><td><button value="Delete" onclick={fn _ => rpc (del r.Id)}/></td></xml>
else
<xml/>}
</tr>
@@ -132,7 +132,7 @@ functor Make(M : sig
{show True lss}
- <button value="Update" onclick={ls <- rpc (allRows ()); set lss ls}/><br/>
+ <button value="Update" onclick={fn _ => ls <- rpc (allRows ()); set lss ls}/><br/>
<br/>
<h2>Batch new rows to add</h2>
@@ -143,12 +143,12 @@ functor Make(M : sig
(fn [nm :: Name] [p ::_] [rest ::_] [[nm] ~ rest] m s =>
<xml><tr> <th>{[m.Nam]}:</th> <td>{m.Widget s}</td> </tr></xml>)
M.fl M.cols inps}
- <tr> <th/> <td><button value="Batch it" onclick={add ()}/></td> </tr>
+ <tr> <th/> <td><button value="Batch it" onclick={fn _ => add ()}/></td> </tr>
</table>
<h2>Already batched:</h2>
{show False batched}
- <button value="Execute" onclick={exec ()}/>
+ <button value="Execute" onclick={fn _ => exec ()}/>
</body></xml>
end
diff --git a/demo/chat.ur b/demo/chat.ur
index 9f18e9ef..720130b4 100644
--- a/demo/chat.ur
+++ b/demo/chat.ur
@@ -40,7 +40,7 @@ fun chat id () =
return <xml><body onload={onload ()}>
<h1>{[r.T.Title]}</h1>
- <button value="Send:" onclick={doSpeak ()}/> <ctextbox source={newLine}/>
+ <button value="Send:" onclick={fn _ => doSpeak ()}/> <ctextbox source={newLine}/>
<h2>Messages</h2>
diff --git a/demo/increment.ur b/demo/increment.ur
index 532ceb83..4ac2b2da 100644
--- a/demo/increment.ur
+++ b/demo/increment.ur
@@ -6,5 +6,5 @@ fun main () =
src <- source 0;
return <xml><body>
<dyn signal={n <- signal src; return <xml>{[n]}</xml>}/>
- <button value="Update" onclick={n <- rpc (increment ()); set src n}/>
+ <button value="Update" onclick={fn _ => n <- rpc (increment ()); set src n}/>
</body></xml>
diff --git a/demo/listEdit.ur b/demo/listEdit.ur
index 1a9851a7..5b45d9a2 100644
--- a/demo/listEdit.ur
+++ b/demo/listEdit.ur
@@ -15,7 +15,7 @@ and show' rl =
Nil => return <xml/>
| Cons {Data = ss, NewData = ss', Tail = rls} => return <xml>
<dyn signal={showString ss}/>
- <button value="Change to:" onclick={s <- get ss'; set ss s}/>
+ <button value="Change to:" onclick={fn _ => s <- get ss'; set ss s}/>
<ctextbox source={ss'}/><br/>
<dyn signal={show rls}/>
</xml>
@@ -46,7 +46,7 @@ fun main () =
end
in
return <xml><body>
- <ctextbox source={data}/> <button value="Add" onclick={add ()}/><br/>
+ <ctextbox source={data}/> <button value="Add" onclick={fn _ => add ()}/><br/>
<br/>
<dyn signal={show head}/>
diff --git a/demo/more/dragList.ur b/demo/more/dragList.ur
index c4e9b69a..df4fc4fc 100644
--- a/demo/more/dragList.ur
+++ b/demo/more/dragList.ur
@@ -5,16 +5,16 @@ fun draggableList title items =
<h2>Great {[title]}</h2>
<ul>
{List.mapX (fn itemSource => <xml>
- <li onmousedown={set draggingItem (Some itemSource)}
- onmouseup={set draggingItem None}
- onmouseover={di <- get draggingItem;
- case di of
- None => return ()
- | Some di => original <- get di;
- movedOver <- get itemSource;
- set di movedOver;
- set itemSource original;
- set draggingItem (Some itemSource)}>
+ <li onmousedown={fn _ => set draggingItem (Some itemSource)}
+ onmouseup={fn _ => set draggingItem None}
+ onmouseover={fn _ => di <- get draggingItem;
+ case di of
+ None => return ()
+ | Some di => original <- get di;
+ movedOver <- get itemSource;
+ set di movedOver;
+ set itemSource original;
+ set draggingItem (Some itemSource)}>
<dyn signal={Monad.mp cdata (signal itemSource)}/>
</li></xml>) itemSources}
</ul>
diff --git a/demo/more/grid.ur b/demo/more/grid.ur
index a281bab7..9691442c 100644
--- a/demo/more/grid.ur
+++ b/demo/more/grid.ur
@@ -124,7 +124,7 @@ functor Make(M : sig
fun render (grid : grid) = <xml>
<table class={tabl}>
<tr class={tr}>
- <th/> <th/> <th><button value="No sort" onclick={set grid.Sort None}/></th>
+ <th/> <th/> <th><button value="No sort" onclick={fn _ => set grid.Sort None}/></th>
{@mapX2 [fst3] [colMeta M.row] [tr]
(fn [nm :: Name] [p :: (Type * Type * Type)] [rest :: {(Type * Type * Type)}] [[nm] ~ rest]
data (meta : colMeta M.row p) =>
@@ -132,7 +132,7 @@ functor Make(M : sig
{case (meta.Handlers data).Sort of
None => txt (meta.Handlers data).Header
| sort => <xml><button value={(meta.Handlers data).Header}
- onclick={set grid.Sort sort}/></xml>}
+ onclick={fn _ => set grid.Sort sort}/></xml>}
</th></xml>)
M.folder grid.Cols M.cols}
</tr>
@@ -197,16 +197,16 @@ functor Make(M : sig
<td>
<dyn signal={b <- signal ud;
return (if b then
- <xml><button value="Save" onclick={save}/></xml>
+ <xml><button value="Save" onclick={fn _ => save}/></xml>
else
- <xml><button value="Update" onclick={update}/></xml>)}/>
+ <xml><button value="Update" onclick={fn _ => update}/></xml>)}/>
</td>
<td><dyn signal={b <- signal ud;
return (if b then
- <xml><button value="Cancel" onclick={cancel}/></xml>
+ <xml><button value="Cancel" onclick={fn _ => cancel}/></xml>
else
- <xml><button value="Delete" onclick={delete}/></xml>)}/>
+ <xml><button value="Delete" onclick={fn _ => delete}/></xml>)}/>
</td>
<dyn signal={cols <- signal colsS;
@@ -302,8 +302,8 @@ functor Make(M : sig
else
<xml>
<button value={show (n + 1)}
- onclick={set grid.Position
- (n * plen)
+ onclick={fn _ => set grid.Position
+ (n * plen)
}/></xml>)}/>
{if (n + 1) * plen >= avail then <xml/> else <xml>|</xml>}
{pages (n + 1)}
@@ -313,9 +313,9 @@ functor Make(M : sig
end)}/>
</xml>}
- <button value="New row" onclick={row <- rpc M.new;
- addRow grid.Cols grid.Rows row}/>
- <button value="Refresh" onclick={sync grid}/>
+ <button value="New row" onclick={fn _ => row <- rpc M.new;
+ addRow grid.Cols grid.Rows row}/>
+ <button value="Refresh" onclick={fn _ => sync grid}/>
</xml>
fun showSelection grid = grid.Selection
diff --git a/demo/more/versioned1.ur b/demo/more/versioned1.ur
index 592af3cf..b5b23fb7 100644
--- a/demo/more/versioned1.ur
+++ b/demo/more/versioned1.ur
@@ -43,17 +43,17 @@ fun main () =
{[kr.Key]}:
<ctextbox source={kr.Nam}/>
<ctextbox size={5} source={kr.ShoeSize}/>
- <button value="Latest" onclick={ro <- rpc (current {Id = kr.Key});
- case ro of
- None => alert "Can't get it!"
- | Some r =>
- set kr.Nam r.Nam;
- set kr.ShoeSize (show r.ShoeSize)}/>
- <button value="Update" onclick={name <- get kr.Nam;
- shoeSize <- get kr.ShoeSize;
- rpc (update {Id = kr.Key,
- Nam = name,
- ShoeSize = readError shoeSize})
+ <button value="Latest" onclick={fn _ => ro <- rpc (current {Id = kr.Key});
+ case ro of
+ None => alert "Can't get it!"
+ | Some r =>
+ set kr.Nam r.Nam;
+ set kr.ShoeSize (show r.ShoeSize)}/>
+ <button value="Update" onclick={fn _ => name <- get kr.Nam;
+ shoeSize <- get kr.ShoeSize;
+ rpc (update {Id = kr.Key,
+ Nam = name,
+ ShoeSize = readError shoeSize})
}/>
</div></xml>) ks)}/>
@@ -63,15 +63,15 @@ fun main () =
<tr><th>Id:</th> <td><ctextbox size={5} source={id}/></td></tr>
<tr><th>Name:</th> <td><ctextbox source={name}/></td></tr>
<tr><th>Shoe size:</th> <td><ctextbox size={5} source={shoeSize}/></td></tr>
- <tr><th><button value="Add" onclick={id <- get id;
- name <- get name;
- shoeSize <- get shoeSize;
- rpc (insert {Id = readError id, Nam = name,
- ShoeSize = readError shoeSize});
+ <tr><th><button value="Add" onclick={fn _ => id <- get id;
+ name <- get name;
+ shoeSize <- get shoeSize;
+ rpc (insert {Id = readError id, Nam = name,
+ ShoeSize = readError shoeSize});
- cur <- get ks;
- kr <- expandKey (readError id);
- set ks (kr :: cur)}/></th></tr>
+ cur <- get ks;
+ kr <- expandKey (readError id);
+ set ks (kr :: cur)}/></th></tr>
</table>
<h2>Archive</h2>
diff --git a/demo/noisy.ur b/demo/noisy.ur
index 068e2ec1..caf5240c 100644
--- a/demo/noisy.ur
+++ b/demo/noisy.ur
@@ -32,12 +32,12 @@ fun main () =
idDel <- source "";
return <xml><body>
- <button value="Check values of 1, 2, and 3" onclick={check (Cons (1, Cons (2, Cons (3, Nil))))}/><br/>
+ <button value="Check values of 1, 2, and 3" onclick={fn _ => check (Cons (1, Cons (2, Cons (3, Nil))))}/><br/>
<br/>
- <button value="Add" onclick={id <- get idAdd; a <- get aAdd; rpc (add (readError id) a)}/>
+ <button value="Add" onclick={fn _ => id <- get idAdd; a <- get aAdd; rpc (add (readError id) a)}/>
<ctextbox source={idAdd}/>
<ctextbox source={aAdd}/><br/>
<br/>
- <button value="Delete" onclick={id <- get idDel; rpc (del (readError id))}/>
+ <button value="Delete" onclick={fn _ => id <- get idDel; rpc (del (readError id))}/>
<ctextbox source={idDel}/>
</body></xml>
diff --git a/demo/react.ur b/demo/react.ur
index 0c460478..35ee9243 100644
--- a/demo/react.ur
+++ b/demo/react.ur
@@ -1,6 +1,6 @@
fun main () =
s <- source "You didn't click it yet.";
return <xml><body>
- <button value="Click me!" onclick={set s "Now you clicked it."}/><br/>
+ <button value="Click me!" onclick={fn _ => set s "Now you clicked it."}/><br/>
<dyn signal={v <- signal s; return <xml>{[v]}</xml>}/>
</body></xml>