wuss 2.0.0.2 → 2.0.1.0
raw patch · 2 files changed
+23/−12 lines, 2 filesdep +exceptionsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: exceptions
API changes (from Hackage documentation)
- Wuss: runSecureClient :: HostName -> PortNumber -> String -> ClientApp a -> IO a
+ Wuss: runSecureClient :: MonadIO m => MonadMask m => HostName -> PortNumber -> String -> ClientApp a -> m a
- Wuss: runSecureClientWith :: HostName -> PortNumber -> String -> ConnectionOptions -> Headers -> ClientApp a -> IO a
+ Wuss: runSecureClientWith :: MonadIO m => MonadMask m => HostName -> PortNumber -> String -> ConnectionOptions -> Headers -> ClientApp a -> m a
- Wuss: runSecureClientWithConfig :: HostName -> PortNumber -> String -> Config -> ConnectionOptions -> Headers -> ClientApp a -> IO a
+ Wuss: runSecureClientWithConfig :: MonadIO m => MonadMask m => HostName -> PortNumber -> String -> Config -> ConnectionOptions -> Headers -> ClientApp a -> m a
Files
- source/library/Wuss.hs +21/−11
- wuss.cabal +2/−1
source/library/Wuss.hs view
@@ -52,8 +52,12 @@ , runSecureClientWithConfig ) where +import Prelude (($), (.))+ import qualified Control.Applicative as Applicative import qualified Control.Exception as Exception+import qualified Control.Monad.IO.Class as MonadIO+import qualified Control.Monad.Catch as Catch import qualified Data.Bool as Bool import qualified Data.ByteString as StrictBytes import qualified Data.ByteString.Lazy as LazyBytes@@ -74,11 +78,13 @@ >>> runSecureClient "echo.websocket.org" 443 "/" app -} runSecureClient- :: Socket.HostName -- ^ Host+ :: MonadIO.MonadIO m+ => Catch.MonadMask m+ => Socket.HostName -- ^ Host -> Socket.PortNumber -- ^ Port -> String.String -- ^ Path -> WebSockets.ClientApp a -- ^ Application- -> IO.IO a+ -> m a runSecureClient host port path app = do let options = WebSockets.defaultConnectionOptions runSecureClientWith host port path options [] app@@ -123,13 +129,15 @@ > return () -} runSecureClientWith- :: Socket.HostName -- ^ Host+ :: MonadIO.MonadIO m+ => Catch.MonadMask m+ => Socket.HostName -- ^ Host -> Socket.PortNumber -- ^ Port -> String.String -- ^ Path -> WebSockets.ConnectionOptions -- ^ Options -> WebSockets.Headers -- ^ Headers -> WebSockets.ClientApp a -- ^ Application- -> IO.IO a+ -> m a runSecureClientWith host port path options headers app = do let config = defaultConfig runSecureClientWithConfig host port path config options headers app@@ -152,20 +160,22 @@ -- | Runs a secure WebSockets client with the given 'Config'. runSecureClientWithConfig- :: Socket.HostName -- ^ Host+ :: MonadIO.MonadIO m+ => Catch.MonadMask m+ => Socket.HostName -- ^ Host -> Socket.PortNumber -- ^ Port -> String.String -- ^ Path -> Config -- ^ Config -> WebSockets.ConnectionOptions -- ^ Options -> WebSockets.Headers -- ^ Headers -> WebSockets.ClientApp a -- ^ Application- -> IO.IO a+ -> m a runSecureClientWithConfig host port path config options headers app = do- context <- Connection.initConnectionContext- Exception.bracket- (Connection.connectTo context (connectionParams host port))- Connection.connectionClose- (\connection -> do+ context <- MonadIO.liftIO Connection.initConnectionContext+ Catch.bracket+ (MonadIO.liftIO $ Connection.connectTo context (connectionParams host port))+ (MonadIO.liftIO . Connection.connectionClose)+ (\connection -> MonadIO.liftIO $ do stream <- Stream.makeStream (reader config connection) (writer connection)
wuss.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: wuss-version: 2.0.0.2+version: 2.0.1.0 synopsis: Secure WebSocket (WSS) clients description:@@ -36,6 +36,7 @@ , connection >= 0.3.1 && < 0.4 , network >= 3.1.1 && < 3.2 , websockets >= 0.12.7 && < 0.13+ , exceptions >= 0.10 && < 0.11 default-language: Haskell2010 ghc-options: -Weverything