network-conduit 0.4.0.1 → 0.5.0
raw patch · 2 files changed
+13/−17 lines, 2 filesdep ~basedep ~conduitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, conduit
API changes (from Hackage documentation)
- Data.Conduit.Network: sinkSocket :: MonadIO m => Socket -> Sink ByteString m ()
+ Data.Conduit.Network: sinkSocket :: MonadIO m => Socket -> GInfSink ByteString m
- Data.Conduit.Network: sourceSocket :: MonadIO m => Socket -> Source m ByteString
+ Data.Conduit.Network: sourceSocket :: MonadIO m => Socket -> GSource m ByteString
Files
- Data/Conduit/Network.hs +11/−15
- network-conduit.cabal +2/−2
Data/Conduit/Network.hs view
@@ -29,6 +29,7 @@ import Control.Exception (bracketOnError, IOException, throwIO, SomeException, try, finally, bracket) import Control.Monad (forever) import Control.Monad.Trans.Control (MonadBaseControl, control)+import Control.Monad.Trans.Class (lift) import Control.Concurrent (forkIO) import Data.String (IsString (fromString)) import qualified Control.Exception as E@@ -38,31 +39,26 @@ -- This function does /not/ automatically close the socket. -- -- Since 0.0.0-sourceSocket :: MonadIO m => Socket -> Source m ByteString+sourceSocket :: MonadIO m => Socket -> GSource m ByteString sourceSocket socket =- src+ loop where- src = PipeM pull close-- pull = do- bs <- liftIO (recv socket 4096)- return $ if S.null bs then Done Nothing () else HaveOutput src close bs- close = return ()+ loop = do+ bs <- lift $ liftIO $ recv socket 4096+ if S.null bs+ then return ()+ else yield bs >> loop -- | Stream data to the socket. -- -- This function does /not/ automatically close the socket. -- -- Since 0.0.0-sinkSocket :: MonadIO m => Socket -> Sink ByteString m ()+sinkSocket :: MonadIO m => Socket -> GInfSink ByteString m sinkSocket socket =- sink+ loop where- sink = NeedInput push (Done Nothing ())-- push bs = PipeM (do- liftIO (sendAll socket bs)- return sink) (return ())+ loop = awaitE >>= either return (\bs -> lift (liftIO $ sendAll socket bs) >> loop) -- | A simple TCP application. It takes two arguments: the @Source@ to read -- input data from, and the @Sink@ to send output data to.
network-conduit.cabal view
@@ -1,5 +1,5 @@ Name: network-conduit-Version: 0.4.0.1+Version: 0.5.0 Synopsis: Stream socket data using conduits. Description: Stream socket data using conduits. License: BSD3@@ -20,7 +20,7 @@ Build-depends: base >= 4 && < 5 , transformers >= 0.2.2 && < 0.4 , bytestring >= 0.9- , conduit >= 0.4 && < 0.5+ , conduit >= 0.5 && < 0.6 , lifted-base >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 if flag(network-bytestring)