packages feed

network-simple 0.4 → 0.4.0.1

raw patch · 3 files changed

+22/−2 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Network.Simple.TCP: sendLazy :: MonadIO m => Socket -> ByteString -> m ()
+ Network.Simple.TCP: sendMany :: MonadIO m => Socket -> [ByteString] -> m ()

Files

changelog.md view
@@ -1,3 +1,8 @@+# Version 0.4.0.1++* Add `sendLazy` and `sendMany` to `Network.Simple.TCP`.++ # Version 0.4  * Bump lower and upper bounds `exceptions` dependency. Replacing some
network-simple.cabal view
@@ -1,5 +1,5 @@ name:                network-simple-version:             0.4+version:             0.4.0.1 homepage:            https://github.com/k0001/network-simple bug-reports:         https://github.com/k0001/network-simple/issues license:             BSD3
src/Network/Simple/TCP.hs view
@@ -36,6 +36,8 @@   -- * Utils   , recv   , send+  , sendLazy+  , sendMany    -- * Low level support   , bindSock@@ -60,10 +62,12 @@ import           Control.Monad import           Control.Monad.IO.Class         (MonadIO(liftIO)) import qualified Data.ByteString                as BS+import qualified Data.ByteString.Lazy           as BSL import           Data.List                      (partition) import qualified Network.Socket                 as NS import           Network.Simple.Internal import qualified Network.Socket.ByteString      as NSB+import qualified Network.Socket.ByteString.Lazy as NSBL  -------------------------------------------------------------------------------- -- $tcp-101@@ -311,10 +315,21 @@         else return (Just bs) {-# INLINABLE recv #-} --- | Writes the given bytes to the socket.+-- | Writes a 'BS.ByteString' to the socket. send :: MonadIO m => NS.Socket -> BS.ByteString -> m () send sock = \bs -> liftIO (NSB.sendAll sock bs) {-# INLINABLE send #-}++-- | Writes a lazy 'BSL.ByteString' to the socket.+sendLazy :: MonadIO m => NS.Socket -> BSL.ByteString -> m ()+sendLazy sock = \bs -> liftIO (NSBL.sendAll sock bs)+{-# INLINABLE sendLazy #-}++-- | Writes the given list of 'BS.ByteString's to the socket.+-- This is faster than sending them individually.+sendMany :: MonadIO m => NS.Socket -> [BS.ByteString] -> m ()+sendMany sock = \bs -> liftIO (NSB.sendMany sock bs)+{-# INLINABLE sendMany #-}  --------------------------------------------------------------------------------