Skip to content

Commit

Permalink
reduce restrictions and dependencies upon feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
L0neGamer committed Jan 22, 2023
1 parent 3a6eee2 commit db2550c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions source/library/Wuss.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ 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
Expand All @@ -67,8 +69,6 @@ import qualified Network.WebSockets as WebSockets
import qualified Network.WebSockets.Stream as Stream
import qualified System.IO as IO
import qualified System.IO.Error as IO.Error
import qualified Control.Monad.IO.Class as MonadIO
import qualified UnliftIO


{- |
Expand All @@ -78,7 +78,8 @@ import qualified UnliftIO
>>> runSecureClient "echo.websocket.org" 443 "/" app
-}
runSecureClient
:: UnliftIO.MonadUnliftIO m
:: MonadIO.MonadIO m
=> Catch.MonadMask m
=> Socket.HostName -- ^ Host
-> Socket.PortNumber -- ^ Port
-> String.String -- ^ Path
Expand Down Expand Up @@ -128,7 +129,8 @@ runSecureClient host port path app = do
> return ()
-}
runSecureClientWith
:: UnliftIO.MonadUnliftIO m
:: MonadIO.MonadIO m
=> Catch.MonadMask m
=> Socket.HostName -- ^ Host
-> Socket.PortNumber -- ^ Port
-> String.String -- ^ Path
Expand Down Expand Up @@ -158,7 +160,8 @@ defaultConfig = do

-- | Runs a secure WebSockets client with the given 'Config'.
runSecureClientWithConfig
:: UnliftIO.MonadUnliftIO m
:: MonadIO.MonadIO m
=> Catch.MonadMask m
=> Socket.HostName -- ^ Host
-> Socket.PortNumber -- ^ Port
-> String.String -- ^ Path
Expand All @@ -169,7 +172,7 @@ runSecureClientWithConfig
-> m a
runSecureClientWithConfig host port path config options headers app = do
context <- MonadIO.liftIO Connection.initConnectionContext
UnliftIO.bracket
Catch.bracket
(MonadIO.liftIO $ Connection.connectTo context (connectionParams host port))
(MonadIO.liftIO . Connection.connectionClose)
(\connection -> MonadIO.liftIO $ do
Expand Down
2 changes: 1 addition & 1 deletion wuss.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ common library
, connection >= 0.3.1 && < 0.4
, network >= 3.1.1 && < 3.2
, websockets >= 0.12.7 && < 0.13
, unliftio >= 0.2.0
, exceptions >= 0.10
default-language: Haskell2010
ghc-options:
-Weverything
Expand Down

0 comments on commit db2550c

Please sign in to comment.