packages feed

network-simple 0.2.0.0 → 0.2.0.1

raw patch · 2 files changed

+42/−2 lines, 2 filesdep +bytestringdep +network-simpledep +stmdep ~basedep ~networknew-component:exe:network-simple-example-chat-tcpnew-component:exe:network-simple-example-echo-tcpPVP ok

version bump matches the API change (PVP)

Dependencies added: bytestring, network-simple, stm, text

Dependency ranges changed: base, network

API changes (from Hackage documentation)

Files

network-simple.cabal view
@@ -1,5 +1,5 @@ name:                network-simple-version:             0.2.0.0+version:             0.2.0.1 homepage:            https://github.com/k0001/network-simple bug-reports:         https://github.com/k0001/network-simple/issues license:             BSD3@@ -33,3 +33,29 @@   other-modules:     Network.Simple.Internal   build-depends:     base (>=4.5 && < 5)                    , network (>=2.3 && <2.5)+++++------------------------------------------------------------------------+-- Examples. All built when the 'examples' flag is given.++flag examples+  description:         Build examples+  default:             False++executable network-simple-example-echo-tcp+  if !flag(examples)+    buildable: False+  hs-source-dirs:      examples+  main-is:             echo-tcp.hs+  build-depends:       base, bytestring, network-simple, network++executable network-simple-example-chat-tcp+  if !flag(examples)+    buildable: False+  hs-source-dirs:      examples+  main-is:             chat-tcp.hs+  build-depends:       base, bytestring, network-simple, network, text,+                       stm+
src/Network/Simple/TCP.hs view
@@ -189,7 +189,9 @@   -> IO ThreadId acceptFork lsock k = do     conn@(csock,_) <- NS.accept lsock-    forkIO $ E.finally (k conn) (NS.sClose csock)+    forkFinally (k conn)+                (\ea -> do NS.sClose csock+                           either E.throwIO return ea) {-# INLINABLE acceptFork #-}  --------------------------------------------------------------------------------@@ -263,3 +265,15 @@ -- Sorting is stable. prioritize :: (a -> Bool) -> [a] -> [a] prioritize p = uncurry (++) . partition p+++--------------------------------------------------------------------------------++-- | 'Control.Concurrent.forkFinally' was introduced in base==4.6.0.0. We'll use+-- our own version here for a while, until base==4.6.0.0 is widely establised.+forkFinally :: IO a -> (Either E.SomeException a -> IO ()) -> IO ThreadId+forkFinally action and_then =+    E.mask $ \restore ->+        forkIO $ E.try (restore action) >>= and_then++