equal
deleted
inserted
replaced
1 module ServerState |
1 module ServerState |
2 ( |
2 ( |
3 module RoomsAndClients, |
3 module RoomsAndClients, |
4 clientRoomA, |
4 clientRoomA, |
5 ServerState(..), |
5 ServerState(..), |
6 clients |
6 client's, |
|
7 allClientsS |
7 ) where |
8 ) where |
8 |
9 |
9 import Control.Monad.State |
10 import Control.Monad.State |
10 ---------------------- |
11 ---------------------- |
11 import RoomsAndClients |
12 import RoomsAndClients |
22 clientRoomA = do |
23 clientRoomA = do |
23 (Just ci) <- gets clientIndex |
24 (Just ci) <- gets clientIndex |
24 rnc <- gets roomsClients |
25 rnc <- gets roomsClients |
25 liftIO $ clientRoomM rnc ci |
26 liftIO $ clientRoomM rnc ci |
26 |
27 |
27 clients :: (ClientInfo -> a) -> StateT ServerState IO a |
28 client's :: (ClientInfo -> a) -> StateT ServerState IO a |
28 clients f = do |
29 client's f = do |
29 (Just ci) <- gets clientIndex |
30 (Just ci) <- gets clientIndex |
30 rnc <- gets roomsClients |
31 rnc <- gets roomsClients |
31 liftIO $ clientsM rnc f ci |
32 liftIO $ client'sM rnc f ci |
32 |
33 |
|
34 allClientsS :: StateT ServerState IO [ClientInfo] |
|
35 allClientsS = gets roomsClients >>= liftIO . clientsM |