From 8a8bfa7ec7a13fe5738fbbe3be770494c8013b83 Mon Sep 17 00:00:00 2001 From: tolysz Date: Mon, 14 Jul 2014 15:10:50 +0100 Subject: [PATCH] correct the wrapper --- yesod-websockets/Yesod/WebSockets.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yesod-websockets/Yesod/WebSockets.hs b/yesod-websockets/Yesod/WebSockets.hs index b47b021e..ff1c31f4 100644 --- a/yesod-websockets/Yesod/WebSockets.hs +++ b/yesod-websockets/Yesod/WebSockets.hs @@ -72,7 +72,7 @@ webSockets inner = do src sink - +-- | Wrapper for capturing exceptions wrapWSE :: (MonadIO m, WS.WebSocketsData a) => (WS.Connection -> a -> IO ())-> a -> WebSocketsT m (Either SomeException ()) wrapWSE ws x = ReaderT $ liftIO . tryAny . flip ws x @@ -103,7 +103,7 @@ sendTextData = wrapWS WS.sendTextData -- `either handle_exception return =<< sendTextDataE ("Welcome" :: Text)` -- Since 0.1.1.3 sendTextDataE :: (MonadIO m, WS.WebSocketsData a) => a -> WebSocketsT m (Either SomeException ()) -sendTextDataE = wrapWS WS.sendTextData +sendTextDataE = wrapWSE WS.sendTextData -- | Send a binary message to the client. -- @@ -112,7 +112,7 @@ sendBinaryData :: (MonadIO m, WS.WebSocketsData a) => a -> WebSocketsT m () sendBinaryData = wrapWS WS.sendBinaryData -- | Send a binary message to the client. --- Capture SomeException as the result or operation +-- Capture SomeException as the result of operation -- Since 0.1.1.3 sendBinaryDataE :: (MonadIO m, WS.WebSocketsData a) => a -> WebSocketsT m (Either SomeException ()) sendBinaryDataE = wrapWSE WS.sendBinaryData