zeromq4-haskell 0.6.4 → 0.6.5
raw patch · 3 files changed
+34/−15 lines, 3 filesdep +monad-controldep +transformers-basedep ~bytestringdep ~containers
Dependencies added: monad-control, transformers-base
Dependency ranges changed: bytestring, containers
Files
- CHANGELOG.md +4/−0
- src/System/ZMQ4/Monadic.hs +17/−4
- zeromq4-haskell.cabal +13/−11
CHANGELOG.md view
@@ -1,3 +1,7 @@+0.6.5+-----------------------------------------------------------------------------+- `MonadBase` and `MonadBaseControl` instances for ZMQ (by Maciej Woś).+ 0.6.4 ----------------------------------------------------------------------------- - Update dependencies.
src/System/ZMQ4/Monadic.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE RankNTypes #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} -- |@@ -183,9 +186,11 @@ import Control.Applicative import Control.Concurrent.Async (Async) import Control.Monad-import Control.Monad.Trans.Reader-import Control.Monad.IO.Class+import Control.Monad.Base (MonadBase(..)) import Control.Monad.Catch+import Control.Monad.IO.Class+import Control.Monad.Trans.Control (MonadBaseControl(..))+import Control.Monad.Trans.Reader import Data.Int import Data.IORef import Data.List.NonEmpty (NonEmpty)@@ -214,6 +219,7 @@ -- unintented use of 'Socket's outside their scope. Cf. the paper -- of John Launchbury and Simon Peyton Jones /Lazy Functional State Threads/. newtype ZMQ z a = ZMQ { _unzmq :: ReaderT ZMQEnv IO a }+ deriving (MonadBase IO) -- | The ZMQ socket, parameterised by 'SocketType' and belonging to -- a particular 'ZMQ' thread.@@ -229,6 +235,11 @@ instance MonadIO (ZMQ z) where liftIO m = ZMQ $! liftIO m +instance MonadBaseControl IO (ZMQ z) where+ type StM (ZMQ z) a = a+ liftBaseWith = \f -> ZMQ $ liftBaseWith $ \q -> f (q . _unzmq)+ restoreM = ZMQ . restoreM+ instance MonadThrow (ZMQ z) where throwM = ZMQ . C.throwM @@ -238,12 +249,14 @@ instance MonadMask (ZMQ z) where mask a = ZMQ . ReaderT $ \env -> C.mask $ \restore ->- let f (ZMQ (ReaderT b)) = ZMQ $ ReaderT (restore . b)+ let f :: forall r a . ZMQ r a -> ZMQ r a+ f (ZMQ (ReaderT b)) = ZMQ $ ReaderT (restore . b) in runReaderT (_unzmq (a $ f)) env uninterruptibleMask a = ZMQ . ReaderT $ \env -> C.uninterruptibleMask $ \restore ->- let f (ZMQ (ReaderT b)) = ZMQ $ ReaderT (restore . b)+ let f :: forall r a . ZMQ r a -> ZMQ r a+ f (ZMQ (ReaderT b)) = ZMQ $ ReaderT (restore . b) in runReaderT (_unzmq (a $ f)) env instance Functor (ZMQ z) where
zeromq4-haskell.cabal view
@@ -1,5 +1,5 @@ name: zeromq4-haskell-version: 0.6.4+version: 0.6.5 synopsis: Bindings to ZeroMQ 4.x category: System, FFI license: MIT@@ -7,9 +7,9 @@ author: Toralf Wittner maintainer: Toralf Wittner <tw@dtex.org> copyright: (c) 2010 - 2015 zeromq-haskell authors-homepage: http://github.com/twittner/zeromq-haskell/+homepage: https://gitlab.com/twittner/zeromq-haskell/ stability: experimental-tested-With: GHC == 7.6.3+tested-With: GHC == 7.10.3 cabal-version: >= 1.8 build-type: Simple extra-source-files:@@ -36,7 +36,7 @@ source-repository head type: git- location: https://github.com/twittner/zeromq-haskell+ location: https://gitlab.com/twittner/zeromq-haskell library hs-source-dirs: src@@ -51,13 +51,15 @@ System.ZMQ4.Internal.Error build-depends:- base >= 3 && < 5- , async >= 2.0 && < 3.0- , bytestring- , containers- , exceptions >= 0.6 && < 1.0- , semigroups >= 0.8- , transformers >= 0.3+ base >= 3 && < 5+ , async >= 2.0 && < 3.0+ , bytestring >= 0.10+ , containers >= 0.5+ , exceptions >= 0.6 && < 1.0+ , semigroups >= 0.8+ , transformers >= 0.3+ , monad-control >= 1.0+ , transformers-base >= 0.4 if impl(ghc < 7.6) build-depends: ghc-prim == 0.3.*