conduit-extra 1.1.2 → 1.1.3
raw patch · 2 files changed
+35/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Conduit.Network: runGeneralTCPClient :: MonadBaseControl IO m => ClientSettings -> (AppData -> m a) -> m a
+ Data.Conduit.Network: runGeneralTCPServer :: MonadBaseControl IO m => ServerSettings -> (AppData -> m ()) -> m ()
Files
- Data/Conduit/Network.hs +34/−2
- conduit-extra.cabal +1/−1
Data/Conduit/Network.hs view
@@ -17,10 +17,12 @@ , serverSettings , SN.runTCPServer , SN.runTCPServerWithHandle+ , runGeneralTCPServer -- ** Client , SN.ClientSettings , clientSettings , SN.runTCPClient+ , runGeneralTCPClient -- ** Getters , SN.getPort , SN.getHost@@ -46,8 +48,8 @@ import qualified Data.ByteString.Char8 as S8 import Control.Monad.IO.Class (MonadIO (liftIO)) import Control.Exception (throwIO, SomeException, try, finally, bracket, IOException, catch)-import Control.Monad (forever, unless)-import Control.Monad.Trans.Control (MonadBaseControl, control)+import Control.Monad (forever, unless, void)+import Control.Monad.Trans.Control (MonadBaseControl, control, liftBaseWith) import Control.Monad.Trans.Class (lift) import Control.Concurrent (forkIO, threadDelay, newEmptyMVar, putMVar, takeMVar) import qualified Data.Streaming.Network as SN@@ -94,3 +96,33 @@ appSink :: (SN.HasReadWrite ad, MonadIO m) => ad -> Consumer ByteString m () appSink ad = awaitForever $ \d -> liftIO $ SN.appWrite ad d >> Conc.yield++-- | Run a general TCP server+--+-- Same as 'SN.runTCPServer', except monad can be any instance of+-- 'MonadBaseControl' 'IO'.+--+-- Note that any changes to the monadic state performed by individual+-- client handlers will be discarded. If you have mutable state you want+-- to share among multiple handlers, you need to use some kind of mutable+-- variables.+--+-- Since 1.1.3+runGeneralTCPServer :: MonadBaseControl IO m+ => SN.ServerSettings+ -> (SN.AppData -> m ())+ -> m ()+runGeneralTCPServer set f = liftBaseWith $ \run ->+ SN.runTCPServer set $ void . run . f++-- | Run a general TCP client+--+-- Same as 'SN.runTCPClient', except monad can be any instance of 'MonadBaseControl' 'IO'.+--+-- Since 1.1.3+runGeneralTCPClient :: MonadBaseControl IO m+ => SN.ClientSettings+ -> (SN.AppData -> m a)+ -> m a+runGeneralTCPClient set f = control $ \run ->+ SN.runTCPClient set $ run . f
conduit-extra.cabal view
@@ -1,5 +1,5 @@ Name: conduit-extra-Version: 1.1.2+Version: 1.1.3 Synopsis: Batteries included conduit: adapters for common libraries. Description: The conduit package itself maintains relative small dependencies. The purpose of this package is to collect commonly used utility functions wrapping other library dependencies, without depending on heavier-weight dependencies. The basic idea is that this package should only depend on haskell-platform packages and conduit.