packages feed

irc-client 1.0.1.1 → 1.1.0.0

raw patch · 3 files changed

+22/−22 lines, 3 filesdep ~conduitdep ~irc-conduitPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: conduit, irc-conduit

API changes (from Hackage documentation)

- Network.IRC.Client.Internal: eventSink :: MonadIO m => IORef UTCTime -> IRCState s -> Consumer (Event ByteString) m ()
+ Network.IRC.Client.Internal: eventSink :: MonadIO m => IORef UTCTime -> IRCState s -> ConduitM (Event ByteString) o m ()
- Network.IRC.Client.Internal: forgetful :: Monad m => Conduit (Either a b) m b
+ Network.IRC.Client.Internal: forgetful :: Monad m => ConduitM (Either a b) b m ()
- Network.IRC.Client.Internal: logConduit :: MonadIO m => (a -> IO ()) -> Conduit a m a
+ Network.IRC.Client.Internal: logConduit :: MonadIO m => (a -> IO ()) -> ConduitM a a m ()
- Network.IRC.Client.Internal: setupInternal :: (IO () -> Consumer (Either ByteString (Event ByteString)) IO () -> Producer IO (Message ByteString) -> IO ()) -> IRC s () -> (Maybe SomeException -> IRC s ()) -> (Origin -> ByteString -> IO ()) -> ByteString -> Int -> ConnectionConfig s
+ Network.IRC.Client.Internal: setupInternal :: (IO () -> ConduitM (Either ByteString (Event ByteString)) Void IO () -> ConduitM () (Message ByteString) IO () -> IO ()) -> IRC s () -> (Maybe SomeException -> IRC s ()) -> (Origin -> ByteString -> IO ()) -> ByteString -> Int -> ConnectionConfig s
- Network.IRC.Client.Internal: sourceTBMChan :: MonadIO m => TBMChan a -> Source m a
+ Network.IRC.Client.Internal: sourceTBMChan :: MonadIO m => TBMChan a -> ConduitM () a m ()
- Network.IRC.Client.Internal.Types: ConnectionConfig :: (IO () -> Consumer (Either ByteString (Event ByteString)) IO () -> Producer IO (Message ByteString) -> IO ()) -> ByteString -> Int -> Text -> Text -> Maybe Text -> NominalDiffTime -> NominalDiffTime -> IRC s () -> (Maybe SomeException -> IRC s ()) -> (Origin -> ByteString -> IO ()) -> ConnectionConfig s
+ Network.IRC.Client.Internal.Types: ConnectionConfig :: (IO () -> ConduitM (Either ByteString (Event ByteString)) Void IO () -> ConduitM () (Message ByteString) IO () -> IO ()) -> ByteString -> Int -> Text -> Text -> Maybe Text -> NominalDiffTime -> NominalDiffTime -> IRC s () -> (Maybe SomeException -> IRC s ()) -> (Origin -> ByteString -> IO ()) -> ConnectionConfig s
- Network.IRC.Client.Internal.Types: [_func] :: ConnectionConfig s -> IO () -> Consumer (Either ByteString (Event ByteString)) IO () -> Producer IO (Message ByteString) -> IO ()
+ Network.IRC.Client.Internal.Types: [_func] :: ConnectionConfig s -> IO () -> ConduitM (Either ByteString (Event ByteString)) Void IO () -> ConduitM () (Message ByteString) IO () -> IO ()

Files

Network/IRC/Client/Internal.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}  -- |@@ -9,7 +8,7 @@ -- License     : MIT -- Maintainer  : Michael Walker <mike@barrucadu.co.uk> -- Stability   : experimental--- Portability : CPP, OverloadedStrings, RankNTypes, ScopedTypeVariables+-- Portability : CPP, OverloadedStrings, 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@@ -32,14 +31,14 @@ import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Reader (ask, runReaderT) import Data.ByteString (ByteString)-import Data.Conduit ((=$=), ($=), (=$), await, awaitForever, toProducer, yield)-import qualified Data.Conduit as C+import Data.Conduit (ConduitM, (.|), await, awaitForever, yield) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import qualified Data.Set as S import Data.Text (Text) import Data.Text.Encoding (decodeUtf8, encodeUtf8) import Data.Time.Clock (NominalDiffTime, UTCTime, addUTCTime, diffUTCTime, getCurrentTime) import Data.Time.Format (formatTime)+import Data.Void (Void) import Network.IRC.Conduit (Event(..), Message(..), Source(..), floodProtector, rawMessage, toByteString)  #if MIN_VERSION_time(1,5,0)@@ -59,7 +58,7 @@ -- | Config to connect to a server using the supplied connection -- function. setupInternal-  :: (IO () -> C.Consumer (Either ByteString (Event ByteString)) IO () -> C.Producer IO (Message ByteString) -> IO ())+  :: (IO () -> ConduitM (Either ByteString (Event ByteString)) Void IO () -> ConduitM () (Message ByteString) IO () -> IO ())   -- ^ Function to start the network conduits.   -> IRC s ()   -- ^ Connect handler@@ -117,11 +116,12 @@    squeue <- liftIO . readTVarIO $ _sendqueue state -  let source = toProducer $ sourceTBMChan squeue-                          $= antiflood-                          $= logConduit (_logfunc cconf FromClient . toByteString)-  let sink   = forgetful =$= logConduit (_logfunc cconf FromServer . _raw)-                         =$ eventSink lastReceived state+  let source = sourceTBMChan squeue+               .| antiflood+               .| logConduit (_logfunc cconf FromClient . toByteString)+  let sink   = forgetful+               .| logConduit (_logfunc cconf FromServer . _raw)+               .| eventSink lastReceived state    -- Fork a thread to disconnect if the timeout elapses.   mainTId <- liftIO myThreadId@@ -144,13 +144,13 @@   _ondisconnect cconf exc  -- | Forget failed decodings.-forgetful :: Monad m => C.Conduit (Either a b) m b+forgetful :: Monad m => ConduitM (Either a b) b m () 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 -> C.Consumer (Event ByteString) m ()+eventSink :: MonadIO m => IORef UTCTime -> IRCState s -> ConduitM (Event ByteString) o 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 ()) -> C.Conduit a m a+logConduit :: MonadIO m => (a -> IO ()) -> ConduitM a a m () logConduit logf = awaitForever $ \x -> do   -- Call the logging function   liftIO $ logf x@@ -325,7 +325,7 @@ -- 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 :: MonadIO m => TBMChan a -> ConduitM () a m () sourceTBMChan ch = loop where   loop = do     a <- liftIO . atomically $ readTBMChan ch
Network/IRC/Client/Internal/Types.hs view
@@ -2,7 +2,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE RankNTypes #-}  -- | -- Module      : Network.IRC.Client.Internal.Types@@ -10,7 +9,7 @@ -- License     : MIT -- Maintainer  : Michael Walker <mike@barrucadu.co.uk> -- Stability   : experimental--- Portability : FlexibleInstances, GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses, RankNTypes+-- Portability : FlexibleInstances, GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses -- -- Internal types. Most of these are re-exported elsewhere as lenses. --@@ -28,10 +27,11 @@ import Control.Monad.Reader (MonadReader, ReaderT, asks) import Control.Monad.State (MonadState(..)) import Data.ByteString (ByteString)-import Data.Conduit (Consumer, Producer)+import Data.Conduit (ConduitM) import qualified Data.Set as S import Data.Text (Text) import Data.Time.Clock (NominalDiffTime)+import Data.Void (Void) import Network.IRC.Conduit (Event(..), Message, Source)  @@ -77,7 +77,7 @@  -- | The static state of an IRC server connection. data ConnectionConfig s = ConnectionConfig-  { _func       :: IO () -> Consumer (Either ByteString (Event ByteString)) IO () -> Producer IO (Message ByteString) -> IO ()+  { _func       :: IO () -> ConduitM (Either ByteString (Event ByteString)) Void IO () -> ConduitM () (Message ByteString) IO () -> IO ()   -- ^ Function to connect and start the conduits.   , _server     :: ByteString   -- ^ The server host.
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.1+version:             1.1.0.0  -- A short (one-line) description of the package. synopsis:            An IRC client library.@@ -89,11 +89,11 @@   build-depends:       base                >=4.7   && <5                      , bytestring          >=0.10  && <0.11                      , containers          >=0.1   && <1-                     , conduit             >=1.2   && <1.4+                     , conduit             >=1.2.8 && <1.4                      , connection          >=0.2   && <0.3                      , contravariant       >=0.1   && <1.5                      , exceptions          >=0.6   && <0.9-                     , irc-conduit         >=0.2.2 && <0.4+                     , irc-conduit         >=0.3   && <0.4                      , irc-ctcp            >=0.1.2 && <0.2                      , mtl                 >=2.1   && <2.3                      , network-conduit-tls >=1.1   && <1.4@@ -124,4 +124,4 @@ source-repository this   type:     git   location: https://github.com/barrucadu/irc-client.git-  tag:      1.0.1.1+  tag:      1.1.0.0