packages feed

pipes-network 0.6.4.1 → 0.6.5

raw patch · 6 files changed

+59/−42 lines, 6 filesdep +exceptionsdep ~bytestringdep ~network-simpledep ~pipessetup-changedPVP ok

version bump matches the API change (PVP)

Dependencies added: exceptions

Dependency ranges changed: bytestring, network-simple, pipes, pipes-safe, transformers

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2012-2016, Renzo Carbonara+Copyright (c) 2012-2018, Renzo Carbonara Copyright (c) 2012-2012, Paolo Capriotti  All rights reserved.
PEOPLE view
@@ -1,7 +1,7 @@ The following people have participated in creating this library, either-by directly contributing code, by providing thoughtful input in-discussions about the library design, or by doing anything else that-helps this library move forwards.+by directly contributing code or by providing thoughtful input in+discussions about the library design. Please note that if you want to be+part of this list you need to add yourself to it.  Renzo Carbonara Gabriel Gonzalez
Setup.hs view
@@ -1,2 +1,4 @@+#! /usr/bin/env nix-shell+#! nix-shell ./shell.nix -i runghc import Distribution.Simple main = defaultMain
changelog.md view
@@ -1,3 +1,12 @@+# Version 0.6.5++* Remover upper bound on all dependencies except `base`.++* Fixed internal error handling in server-side functions.++* Re-export `MonadSafe`.++ # Version 0.6.4.1  * Raise upper-bound dependency on `transformers` and `pipes`.
pipes-network.cabal view
@@ -1,12 +1,12 @@ name:               pipes-network-version:            0.6.4.1+version:            0.6.5 license:            BSD3 license-file:       LICENSE-copyright:          Copyright (c) Renzo Carbonara 2012-2016, Paolo Capriotti 2012-2012.+copyright:          Copyright (c) Renzo Carbonara 2012-2018, Paolo Capriotti 2012-2012. author:             Renzo Carbonara maintainer:         renzocarbonaraλgmail.com stability:          Experimental-tested-with:        GHC == 8.0.1+tested-with:        GHC == 8.4.1 homepage:           https://github.com/k0001/pipes-network bug-reports:        https://github.com/k0001/pipes-network/issues category:           Pipes, Network@@ -33,18 +33,19 @@  source-repository head     type: git-    location: git://github.com/k0001/pipes-network.git+    location: https://github.com/k0001/pipes-network  library     hs-source-dirs: src     build-depends:-        base           (==4.*),-        bytestring     (>=0.9.2.1),+        base ==4.*,+        bytestring,+        exceptions,         network,-        network-simple (>=0.4.0.1 && <0.5),-        pipes          (>=4.0 && <4.3),-        pipes-safe     (>=2.1 && <2.3),-        transformers   (>=0.2 && <0.6)+        network-simple,+        pipes,+        pipes-safe,+        transformers     exposed-modules:         Pipes.Network.TCP         Pipes.Network.TCP.Safe
src/Pipes/Network/TCP/Safe.hs view
@@ -1,4 +1,6 @@-{-# LANGUAGE Rank2Types, TypeFamilies #-}+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeFamilies #-}  -- | This module exports facilities allowing you to safely obtain, use and -- release 'Socket' resources within a /Pipes/ pipeline, by relying on@@ -6,7 +8,7 @@ -- -- This module is meant to be used as a replacement of "Pipes.Network.TCP", -- and as such it overrides some functions from "Network.Simple.TCP" so that--- they use 'Ps.MonadSafe' instead of 'IO' as their base monad. Additionally,+-- they use 'MonadSafe' instead of 'IO' as their base monad. Additionally, -- It also exports pipes that establish a TCP connection and interact with -- it in a streaming fashion at once. --@@ -42,8 +44,10 @@   ) where  import           Control.Monad+import qualified Control.Monad.Catch    as C import qualified Data.ByteString        as B import qualified Data.ByteString.Lazy   as BL+import qualified Network.Simple.TCP     as T import           Network.Simple.TCP                   (acceptFork, bindSock, connectSock, closeSock, recv, send,                    sendLazy, sendMany, withSocketsDo, HostName,@@ -56,38 +60,38 @@                    fromSocketTimeoutN, toSocket, toSocketLazy, toSocketMany,                    toSocketTimeout, toSocketTimeoutLazy, toSocketTimeoutMany) import qualified Pipes.Safe             as Ps-import           Pipes.Safe             (runSafeT)+import           Pipes.Safe             (runSafeT, MonadSafe)  --------------------------------------------------------------------------------  -- $network-simple-upgrades -- -- The following functions are analogous versions of those exported by--- "Network.Simple.TCP", but compatible with 'Ps.MonadSafe'.+-- "Network.Simple.TCP", but compatible with 'MonadSafe'.  -- | Like 'Network.Simple.TCP.connect' from "Network.Simple.TCP", but compatible--- with 'Ps.MonadSafe'.+-- with 'MonadSafe'. connect-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostName -> ServiceName -> ((Socket, SockAddr) -> m r) -> m r connect host port = Ps.bracket (connectSock host port)-                               (liftIO . NS.sClose . fst)+                               (T.closeSock . fst)  -- | Like 'Network.Simple.TCP.serve' from "Network.Simple.TCP", but compatible--- with 'Ps.MonadSafe'.+-- with 'MonadSafe'. serve-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostPreference -> ServiceName -> ((Socket, SockAddr) -> IO ()) -> m r serve hp port k = do    listen hp port $ \(lsock,_) -> do       forever $ acceptFork lsock k  -- | Like 'Network.Simple.TCP.listen' from "Network.Simple.TCP", but compatible--- with 'Ps.MonadSafe'.+-- with 'MonadSafe'. listen-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostPreference -> ServiceName -> ((Socket, SockAddr) -> m r) -> m r-listen hp port = Ps.bracket listen' (liftIO . NS.sClose . fst)+listen hp port = Ps.bracket listen' (T.closeSock . fst)   where     listen' = liftIO $ do         x@(bsock,_) <- bindSock hp port@@ -95,13 +99,13 @@         return x  -- | Like 'Network.Simple.TCP.accept' from "Network.Simple.TCP", but compatible--- with 'Ps.MonadSafe'.+-- with 'MonadSafe'. accept-  :: Ps.MonadSafe m+  :: MonadSafe m   => Socket -> ((Socket, SockAddr) -> m r) -> m r accept lsock k = do     conn@(csock,_) <- liftIO (NS.accept lsock)-    Ps.finally (k conn) (liftIO $ NS.sClose csock)+    Ps.finally (k conn) (T.closeSock csock) {-# INLINABLE accept #-}  --------------------------------------------------------------------------------@@ -127,7 +131,7 @@ -- -- >>> runSafeT . runEffect $ fromConnect 4096 "127.0.0.1" "9000" >-> P.print fromConnect-  :: Ps.MonadSafe m+  :: MonadSafe m   => Int             -- ^Maximum number of bytes to receive and send                      -- dowstream at once. Any positive value is fine, the                      -- optimal value depends on how you deal with the@@ -148,7 +152,7 @@ -- >>> :set -XOverloadedStrings -- >>> runSafeT . runEffect $ each ["He","llo\r\n"] >-> toConnect "127.0.0.1" "9000" toConnect-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostName        -- ^Server host name.   -> ServiceName     -- ^Server service port.   -> Consumer' B.ByteString m r@@ -157,7 +161,7 @@ -- | Like 'toConnect', but works more efficiently on lazy 'BL.ByteString's -- (compared to converting them to a strict 'B.ByteString' and sending it) toConnectLazy-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostName        -- ^Server host name.   -> ServiceName     -- ^Server service port.   -> Consumer' BL.ByteString m r@@ -166,14 +170,14 @@ -- | Like 'toConnect', but works more efficiently on @['B.ByteString']@ -- (compared to converting them to a strict 'B.ByteString' and sending it) toConnectMany-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostName        -- ^Server host name.   -> ServiceName     -- ^Server service port.   -> Consumer' [B.ByteString] m r toConnectMany = _connect toSocketMany  _connect-  :: Ps.MonadSafe m+  :: MonadSafe m   => (Socket -> m r) -- ^Action to perform on the connection socket.   -> HostName        -- ^Server host name.   -> ServiceName     -- ^Server service port.@@ -213,7 +217,7 @@ -- >>> :set -XOverloadedStrings -- >>> runSafeT . runEffect $ fromServe 4096 "127.0.0.1" "9000" >-> P.print fromServe-  :: Ps.MonadSafe m+  :: MonadSafe m   => Int             -- ^Maximum number of bytes to receive and send                      -- dowstream at once. Any positive value is fine, the                      -- optimal value depends on how you deal with the@@ -235,7 +239,7 @@ -- >>> :set -XOverloadedStrings -- >>> runSafeT . runEffect $ each ["He","llo\r\n"] >-> toServe "127.0.0.1" "9000" toServe-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostPreference  -- ^Preferred host to bind.   -> ServiceName     -- ^Service port to bind.   -> Consumer' B.ByteString m r@@ -244,7 +248,7 @@ -- | Like 'toServe', but works more efficiently on lazy 'BL.ByteString's -- (compared to converting them to a strict 'B.ByteString' and sending it) toServeLazy-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostPreference  -- ^Preferred host to bind.   -> ServiceName     -- ^Service port to bind.   -> Consumer' BL.ByteString m r@@ -253,14 +257,14 @@ -- | Like 'toServe', but works more efficiently on @['B.ByteString']@ -- (compared to converting them to a strict 'B.ByteString' and sending it) toServeMany-  :: Ps.MonadSafe m+  :: MonadSafe m   => HostPreference  -- ^Preferred host to bind.   -> ServiceName     -- ^Service port to bind.   -> Consumer' [B.ByteString] m r toServeMany = _serve toSocketMany  _serve-  :: Ps.MonadSafe m+  :: MonadSafe m   => (Socket -> m r) -- ^Action to perform on the connection socket.   -> HostPreference  -- ^Preferred host to bind.   -> ServiceName     -- ^Service port to bind.@@ -268,8 +272,8 @@ _serve act hp port = do    listen hp port $ \(lsock,_) -> do       accept lsock $ \(csock,_) -> do-         closeSock lsock -- We prevent more connection attempts to happen-                         -- while we deal with `csock`.+         -- We prevent further connection attempts while we deal with `csock`.+         C.catch (closeSock lsock) (\(_ :: IOError) -> pure ())          act csock {-# INLINABLE _serve #-} @@ -308,4 +312,5 @@ --    'withSocketsDo'. -- -- [From "Pipes.Safe"]---    'Ps.runSafeT'.+--    'runSafeT',+--    'MonadSafe'.