From cd8ad59c2f96c3ed7b59222133754e0ebb7fb748 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 9 Jan 2020 20:55:40 +0000 Subject: [PATCH] Rename ConnectionConfig record accessors The old prefix didn't make sense any more with the renamed type. --- src/Haboli/Euphoria/Client.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Haboli/Euphoria/Client.hs b/src/Haboli/Euphoria/Client.hs index ab22ec5..3134af5 100644 --- a/src/Haboli/Euphoria/Client.hs +++ b/src/Haboli/Euphoria/Client.hs @@ -172,33 +172,33 @@ runWebsocketThread info = parseAndSendReply value (ciAwaiting info) where connection = ciConnection info - pingInterval = cdPingInterval $ ciDetails info + pingInterval = confPingInterval $ ciDetails info {- Running the Client monad -} -- | Configuration for the websocket connection. The websocket connection always -- uses https. data ConnectionConfig = ConnectionConfig - { cdHost :: S.HostName - , cdPort :: S.PortNumber - , cdPath :: String - , cdPingInterval :: Int + { confHost :: S.HostName + , confPort :: S.PortNumber + , confPath :: String + , confPingInterval :: Int } deriving (Show) -- | A default configuration that points the bot to the room @&test@ at -- . defaultConfig :: ConnectionConfig defaultConfig = ConnectionConfig - { cdHost = "euphoria.io" - , cdPort = 443 - , cdPath = "/room/test/ws" - , cdPingInterval = 10 + { confHost = "euphoria.io" + , confPort = 443 + , confPath = "/room/test/ws" + , confPingInterval = 10 } -- | @'withRoom' roomname config@ modifies the 'cdPath' of @config@ to point to -- the room @roomname@. withRoom :: String -> ConnectionConfig -> ConnectionConfig -withRoom room config = config{cdPath = "/room/" ++ room ++ "/ws"} +withRoom room config = config{confPath = "/room/" ++ room ++ "/ws"} --TODO: Catch IO exceptions that occur when a connection could not be created -- | Execute a 'Client'. @@ -213,7 +213,7 @@ withRoom room config = config{cdPath = "/room/" ++ room ++ "/ws"} runClient :: ConnectionConfig -> Client e a -> IO (Either (ClientException e) a) runClient details (Client stack) = S.withSocketsDo $ - WSS.runSecureClient (cdHost details) (cdPort details) (cdPath details) $ \connection -> do + WSS.runSecureClient (confHost details) (confPort details) (confPath details) $ \connection -> do awaiting <- newTVarIO Map.empty eventChan <- newTChanIO packetId <- newTVarIO 0