irc-client 1.0.1.0 → 1.0.1.1
raw patch · 4 files changed
+34/−16 lines, 4 filesdep +stm-chansdep −stm-conduitdep ~conduitdep ~irc-conduitdep ~network-conduit-tlsPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependencies added: stm-chans
Dependencies removed: stm-conduit
Dependency ranges changed: conduit, irc-conduit, network-conduit-tls
API changes (from Hackage documentation)
+ Network.IRC.Client.Internal: sourceTBMChan :: MonadIO m => TBMChan a -> Source m a
Files
- Network/IRC/Client.hs +1/−1
- Network/IRC/Client/Internal.hs +24/−8
- Network/IRC/Client/Internal/Types.hs +1/−1
- irc-client.cabal +8/−6
Network/IRC/Client.hs view
@@ -163,10 +163,10 @@ ) where import Control.Concurrent.STM (newTVarIO)+import Control.Concurrent.STM.TBMChan (newTBMChanIO) import Control.Monad.IO.Class (MonadIO, liftIO) import Data.ByteString (ByteString) import qualified Data.Conduit.Network.TLS as TLS-import Data.Conduit.TMChan (newTBMChanIO) import qualified Data.Set as S import Data.Text (Text) import qualified Data.Text as T
Network/IRC/Client/Internal.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-}-{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -10,7 +9,7 @@ -- License : MIT -- Maintainer : Michael Walker <mike@barrucadu.co.uk> -- Stability : experimental--- Portability : CPP, LambdaCase, OverloadedStrings, RankNTypes, ScopedTypeVariables+-- Portability : CPP, OverloadedStrings, RankNTypes, ScopedTypeVariables -- -- Most of the hairy code. This isn't all internal, due to messy -- dependencies, but I've tried to make this as \"internal\" as@@ -27,13 +26,14 @@ import Control.Applicative ((<$>)) import Control.Concurrent (forkIO, killThread, myThreadId, threadDelay, throwTo) import Control.Concurrent.STM (STM, atomically, readTVar, readTVarIO, writeTVar)+import Control.Concurrent.STM.TBMChan (TBMChan, closeTBMChan, isClosedTBMChan, isEmptyTBMChan, readTBMChan, writeTBMChan, newTBMChan) import Control.Monad (forM_, unless, void, when) import Control.Monad.Catch (SomeException, catch) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Reader (ask, runReaderT) import Data.ByteString (ByteString)-import Data.Conduit (Producer, Conduit, Consumer, (=$=), ($=), (=$), await, awaitForever, toProducer, yield)-import Data.Conduit.TMChan (closeTBMChan, isClosedTBMChan, isEmptyTBMChan, sourceTBMChan, writeTBMChan, newTBMChan)+import Data.Conduit ((=$=), ($=), (=$), await, awaitForever, toProducer, yield)+import qualified Data.Conduit as C import Data.IORef (IORef, newIORef, readIORef, writeIORef) import qualified Data.Set as S import Data.Text (Text)@@ -59,7 +59,7 @@ -- | Config to connect to a server using the supplied connection -- function. setupInternal- :: (IO () -> Consumer (Either ByteString (Event ByteString)) IO () -> Producer IO (Message ByteString) -> IO ())+ :: (IO () -> C.Consumer (Either ByteString (Event ByteString)) IO () -> C.Producer IO (Message ByteString) -> IO ()) -- ^ Function to start the network conduits. -> IRC s () -- ^ Connect handler@@ -144,13 +144,13 @@ _ondisconnect cconf exc -- | Forget failed decodings.-forgetful :: Monad m => Conduit (Either a b) m b+forgetful :: Monad m => C.Conduit (Either a b) m b forgetful = awaitForever go where go (Left _) = return () go (Right b) = yield b -- | Block on receiving a message and invoke all matching handlers.-eventSink :: MonadIO m => IORef UTCTime -> IRCState s -> Consumer (Event ByteString) m ()+eventSink :: MonadIO m => IORef UTCTime -> IRCState s -> C.Consumer (Event ByteString) m () eventSink lastReceived ircstate = go where go = await >>= maybe (return ()) (\event -> do -- Record the current time.@@ -184,7 +184,7 @@ Server _ -> False -- |A conduit which logs everything which goes through it.-logConduit :: MonadIO m => (a -> IO ()) -> Conduit a m a+logConduit :: MonadIO m => (a -> IO ()) -> C.Conduit a m a logConduit logf = awaitForever $ \x -> do -- Call the logging function liftIO $ logf x@@ -316,3 +316,19 @@ cond <- check when (now < finish && not cond) wait wait++-- | A simple wrapper around a TBMChan. As data is pushed into the+-- channel, the source will read it and pass it down the conduit+-- pipeline. When the channel is closed, the source will close also.+--+-- If the channel fills up, the pipeline will stall until values are+-- read.+--+-- From stm-conduit-3.0.0 (by Clark Gaebel <cg.wowus.cg@gmail.com>)+sourceTBMChan :: MonadIO m => TBMChan a -> C.Source m a+sourceTBMChan ch = loop where+ loop = do+ a <- liftIO . atomically $ readTBMChan ch+ case a of+ Just x -> yield x >> loop+ Nothing -> pure ()
Network/IRC/Client/Internal/Types.hs view
@@ -21,6 +21,7 @@ import Control.Applicative (Alternative) import Control.Concurrent (ThreadId) import Control.Concurrent.STM (TVar, atomically, readTVar, writeTVar)+import Control.Concurrent.STM.TBMChan (TBMChan) import Control.Monad (MonadPlus) import Control.Monad.Catch (Exception, MonadThrow, MonadCatch, MonadMask, SomeException) import Control.Monad.IO.Class (MonadIO, liftIO)@@ -28,7 +29,6 @@ import Control.Monad.State (MonadState(..)) import Data.ByteString (ByteString) import Data.Conduit (Consumer, Producer)-import Data.Conduit.TMChan (TBMChan) import qualified Data.Set as S import Data.Text (Text) import Data.Time.Clock (NominalDiffTime)
irc-client.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 1.0.1.0+version: 1.0.1.1 -- A short (one-line) description of the package. synopsis: An IRC client library.@@ -89,18 +89,18 @@ build-depends: base >=4.7 && <5 , bytestring >=0.10 && <0.11 , containers >=0.1 && <1- , conduit >=1.2 && <1.3+ , conduit >=1.2 && <1.4 , connection >=0.2 && <0.3 , contravariant >=0.1 && <1.5 , exceptions >=0.6 && <0.9- , irc-conduit >=0.2.2 && <0.3+ , irc-conduit >=0.2.2 && <0.4 , irc-ctcp >=0.1.2 && <0.2 , mtl >=2.1 && <2.3- , network-conduit-tls >=1.1 && <1.3+ , network-conduit-tls >=1.1 && <1.4 , old-locale >=1.0 && <1.1 , profunctors >=5 && <6 , stm >=2.4 && <2.5- , stm-conduit >=2.5 && <3.1+ , stm-chans >=2.0 && <3.1 , text >=1.1 && <1.3 , time >=1.4 && <1.9 , tls >=1.3 && <1.5@@ -114,6 +114,8 @@ -- Base language which the package is written in. default-language: Haskell2010++ ghc-options: -Wall source-repository head type: git@@ -122,4 +124,4 @@ source-repository this type: git location: https://github.com/barrucadu/irc-client.git- tag: 1.0.1.0+ tag: 1.0.1.1