equal
deleted
inserted
replaced
7 import Control.Exception (finally) |
7 import Control.Exception (finally) |
8 |
8 |
9 data ClientInfo = |
9 data ClientInfo = |
10 ClientInfo |
10 ClientInfo |
11 { |
11 { |
|
12 chan :: TChan String, |
12 handle :: Handle, |
13 handle :: Handle, |
13 nick :: String, |
14 nick :: String, |
14 room :: String, |
15 room :: String, |
15 isMaster :: Bool |
16 isMaster :: Bool |
16 } |
17 } |
49 ls2 <- readTVar state2 |
50 ls2 <- readTVar state2 |
50 let (ol1, ol2, res) = op ls1 ls2 |
51 let (ol1, ol2, res) = op ls1 ls2 |
51 writeTVar state1 ol1 |
52 writeTVar state1 ol1 |
52 writeTVar state2 ol2 |
53 writeTVar state2 ol2 |
53 return res |
54 return res |
54 |
55 |
|
56 tselect :: [ClientInfo] -> STM (String, Handle) |
|
57 tselect = foldl orElse retry . map (\ci -> (flip (,) (handle ci)) `fmap` readTChan (chan ci)) |
|
58 |