comparison tests/chat.ur @ 680:54ec237a3028

Marshalcheck
author Adam Chlipala <adamc@hcoop.net>
date Sat, 28 Mar 2009 11:13:36 -0400
parents 44f23712020d
children 5bbb542243e8
comparison
equal deleted inserted replaced
679:44f23712020d 680:54ec237a3028
23 newLine <- source ""; 23 newLine <- source "";
24 logHead <- source End; 24 logHead <- source End;
25 logTail <- source logHead; 25 logTail <- source logHead;
26 26
27 let 27 let
28 fun join () = subscribe ch 28 fun getCh () =
29 r <- oneRow (SELECT t.Chan FROM t WHERE t.Id = {[id]});
30 case r.T.Chan of
31 None => error <xml>Channel disappeared</xml>
32 | Some ch => return ch
33
34 fun join () =
35 ch <- getCh ();
36 subscribe ch
29 37
30 fun onload () = 38 fun onload () =
31 let 39 let
32 fun listener () = 40 fun listener () =
33 s <- recv ch; 41 s <- recv ch;
40 join (); 48 join ();
41 listener () 49 listener ()
42 end 50 end
43 51
44 fun speak line = 52 fun speak line =
53 ch <- getCh ();
45 send ch line 54 send ch line
46 55
47 fun doSpeak () = 56 fun doSpeak () =
48 line <- get newLine; 57 line <- get newLine;
49 speak line 58 speak line