{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Network.IRC.Client.Internal.Types where
import Control.Applicative (Alternative)
import Control.Concurrent (ThreadId)
import Control.Concurrent.STM (TVar, atomically, readTVar,
readTVarIO, writeTVar)
import Control.Concurrent.STM.TBMChan (TBMChan)
import Control.Monad (MonadPlus)
import Control.Monad.Catch (Exception, MonadCatch,
MonadMask, MonadThrow,
SomeException)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Reader (MonadReader, ReaderT, asks)
import Control.Monad.State (MonadState(..))
import Data.ByteString (ByteString)
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)
newtype IRC s a = IRC { IRC s a -> ReaderT (IRCState s) IO a
runIRC :: ReaderT (IRCState s) IO a }
deriving (a -> IRC s b -> IRC s a
(a -> b) -> IRC s a -> IRC s b
(forall a b. (a -> b) -> IRC s a -> IRC s b)
-> (forall a b. a -> IRC s b -> IRC s a) -> Functor (IRC s)
forall a b. a -> IRC s b -> IRC s a
forall a b. (a -> b) -> IRC s a -> IRC s b
forall s a b. a -> IRC s b -> IRC s a
forall s a b. (a -> b) -> IRC s a -> IRC s b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> IRC s b -> IRC s a
$c<$ :: forall s a b. a -> IRC s b -> IRC s a
fmap :: (a -> b) -> IRC s a -> IRC s b
$cfmap :: forall s a b. (a -> b) -> IRC s a -> IRC s b
Functor, Functor (IRC s)
a -> IRC s a
Functor (IRC s)
-> (forall a. a -> IRC s a)
-> (forall a b. IRC s (a -> b) -> IRC s a -> IRC s b)
-> (forall a b c. (a -> b -> c) -> IRC s a -> IRC s b -> IRC s c)
-> (forall a b. IRC s a -> IRC s b -> IRC s b)
-> (forall a b. IRC s a -> IRC s b -> IRC s a)
-> Applicative (IRC s)
IRC s a -> IRC s b -> IRC s b
IRC s a -> IRC s b -> IRC s a
IRC s (a -> b) -> IRC s a -> IRC s b
(a -> b -> c) -> IRC s a -> IRC s b -> IRC s c
forall s. Functor (IRC s)
forall a. a -> IRC s a
forall s a. a -> IRC s a
forall a b. IRC s a -> IRC s b -> IRC s a
forall a b. IRC s a -> IRC s b -> IRC s b
forall a b. IRC s (a -> b) -> IRC s a -> IRC s b
forall s a b. IRC s a -> IRC s b -> IRC s a
forall s a b. IRC s a -> IRC s b -> IRC s b
forall s a b. IRC s (a -> b) -> IRC s a -> IRC s b
forall a b c. (a -> b -> c) -> IRC s a -> IRC s b -> IRC s c
forall s a b c. (a -> b -> c) -> IRC s a -> IRC s b -> IRC s c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: IRC s a -> IRC s b -> IRC s a
$c<* :: forall s a b. IRC s a -> IRC s b -> IRC s a
*> :: IRC s a -> IRC s b -> IRC s b
$c*> :: forall s a b. IRC s a -> IRC s b -> IRC s b
liftA2 :: (a -> b -> c) -> IRC s a -> IRC s b -> IRC s c
$cliftA2 :: forall s a b c. (a -> b -> c) -> IRC s a -> IRC s b -> IRC s c
<*> :: IRC s (a -> b) -> IRC s a -> IRC s b
$c<*> :: forall s a b. IRC s (a -> b) -> IRC s a -> IRC s b
pure :: a -> IRC s a
$cpure :: forall s a. a -> IRC s a
$cp1Applicative :: forall s. Functor (IRC s)
Applicative, Applicative (IRC s)
IRC s a
Applicative (IRC s)
-> (forall a. IRC s a)
-> (forall a. IRC s a -> IRC s a -> IRC s a)
-> (forall a. IRC s a -> IRC s [a])
-> (forall a. IRC s a -> IRC s [a])
-> Alternative (IRC s)
IRC s a -> IRC s a -> IRC s a
IRC s a -> IRC s [a]
IRC s a -> IRC s [a]
forall s. Applicative (IRC s)
forall a. IRC s a
forall a. IRC s a -> IRC s [a]
forall a. IRC s a -> IRC s a -> IRC s a
forall s a. IRC s a
forall s a. IRC s a -> IRC s [a]
forall s a. IRC s a -> IRC s a -> IRC s a
forall (f :: * -> *).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
many :: IRC s a -> IRC s [a]
$cmany :: forall s a. IRC s a -> IRC s [a]
some :: IRC s a -> IRC s [a]
$csome :: forall s a. IRC s a -> IRC s [a]
<|> :: IRC s a -> IRC s a -> IRC s a
$c<|> :: forall s a. IRC s a -> IRC s a -> IRC s a
empty :: IRC s a
$cempty :: forall s a. IRC s a
$cp1Alternative :: forall s. Applicative (IRC s)
Alternative, Applicative (IRC s)
a -> IRC s a
Applicative (IRC s)
-> (forall a b. IRC s a -> (a -> IRC s b) -> IRC s b)
-> (forall a b. IRC s a -> IRC s b -> IRC s b)
-> (forall a. a -> IRC s a)
-> Monad (IRC s)
IRC s a -> (a -> IRC s b) -> IRC s b
IRC s a -> IRC s b -> IRC s b
forall s. Applicative (IRC s)
forall a. a -> IRC s a
forall s a. a -> IRC s a
forall a b. IRC s a -> IRC s b -> IRC s b
forall a b. IRC s a -> (a -> IRC s b) -> IRC s b
forall s a b. IRC s a -> IRC s b -> IRC s b
forall s a b. IRC s a -> (a -> IRC s b) -> IRC s b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> IRC s a
$creturn :: forall s a. a -> IRC s a
>> :: IRC s a -> IRC s b -> IRC s b
$c>> :: forall s a b. IRC s a -> IRC s b -> IRC s b
>>= :: IRC s a -> (a -> IRC s b) -> IRC s b
$c>>= :: forall s a b. IRC s a -> (a -> IRC s b) -> IRC s b
$cp1Monad :: forall s. Applicative (IRC s)
Monad, Monad (IRC s)
Alternative (IRC s)
IRC s a
Alternative (IRC s)
-> Monad (IRC s)
-> (forall a. IRC s a)
-> (forall a. IRC s a -> IRC s a -> IRC s a)
-> MonadPlus (IRC s)
IRC s a -> IRC s a -> IRC s a
forall s. Monad (IRC s)
forall s. Alternative (IRC s)
forall a. IRC s a
forall a. IRC s a -> IRC s a -> IRC s a
forall s a. IRC s a
forall s a. IRC s a -> IRC s a -> IRC s a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
mplus :: IRC s a -> IRC s a -> IRC s a
$cmplus :: forall s a. IRC s a -> IRC s a -> IRC s a
mzero :: IRC s a
$cmzero :: forall s a. IRC s a
$cp2MonadPlus :: forall s. Monad (IRC s)
$cp1MonadPlus :: forall s. Alternative (IRC s)
MonadPlus, Monad (IRC s)
Monad (IRC s) -> (forall a. IO a -> IRC s a) -> MonadIO (IRC s)
IO a -> IRC s a
forall s. Monad (IRC s)
forall a. IO a -> IRC s a
forall s a. IO a -> IRC s a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> IRC s a
$cliftIO :: forall s a. IO a -> IRC s a
$cp1MonadIO :: forall s. Monad (IRC s)
MonadIO, MonadReader (IRCState s), Monad (IRC s)
e -> IRC s a
Monad (IRC s)
-> (forall e a. Exception e => e -> IRC s a) -> MonadThrow (IRC s)
forall s. Monad (IRC s)
forall e a. Exception e => e -> IRC s a
forall s e a. Exception e => e -> IRC s a
forall (m :: * -> *).
Monad m -> (forall e a. Exception e => e -> m a) -> MonadThrow m
throwM :: e -> IRC s a
$cthrowM :: forall s e a. Exception e => e -> IRC s a
$cp1MonadThrow :: forall s. Monad (IRC s)
MonadThrow, MonadThrow (IRC s)
MonadThrow (IRC s)
-> (forall e a.
Exception e =>
IRC s a -> (e -> IRC s a) -> IRC s a)
-> MonadCatch (IRC s)
IRC s a -> (e -> IRC s a) -> IRC s a
forall s. MonadThrow (IRC s)
forall e a. Exception e => IRC s a -> (e -> IRC s a) -> IRC s a
forall s e a. Exception e => IRC s a -> (e -> IRC s a) -> IRC s a
forall (m :: * -> *).
MonadThrow m
-> (forall e a. Exception e => m a -> (e -> m a) -> m a)
-> MonadCatch m
catch :: IRC s a -> (e -> IRC s a) -> IRC s a
$ccatch :: forall s e a. Exception e => IRC s a -> (e -> IRC s a) -> IRC s a
$cp1MonadCatch :: forall s. MonadThrow (IRC s)
MonadCatch, MonadCatch (IRC s)
MonadCatch (IRC s)
-> (forall b.
((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b)
-> (forall b.
((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b)
-> (forall a b c.
IRC s a
-> (a -> ExitCase b -> IRC s c) -> (a -> IRC s b) -> IRC s (b, c))
-> MonadMask (IRC s)
IRC s a
-> (a -> ExitCase b -> IRC s c) -> (a -> IRC s b) -> IRC s (b, c)
((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
forall s. MonadCatch (IRC s)
forall b. ((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
forall s b. ((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
forall a b c.
IRC s a
-> (a -> ExitCase b -> IRC s c) -> (a -> IRC s b) -> IRC s (b, c)
forall s a b c.
IRC s a
-> (a -> ExitCase b -> IRC s c) -> (a -> IRC s b) -> IRC s (b, c)
forall (m :: * -> *).
MonadCatch m
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall a b c.
m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c))
-> MonadMask m
generalBracket :: IRC s a
-> (a -> ExitCase b -> IRC s c) -> (a -> IRC s b) -> IRC s (b, c)
$cgeneralBracket :: forall s a b c.
IRC s a
-> (a -> ExitCase b -> IRC s c) -> (a -> IRC s b) -> IRC s (b, c)
uninterruptibleMask :: ((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
$cuninterruptibleMask :: forall s b. ((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
mask :: ((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
$cmask :: forall s b. ((forall a. IRC s a -> IRC s a) -> IRC s b) -> IRC s b
$cp1MonadMask :: forall s. MonadCatch (IRC s)
MonadMask)
instance MonadState s (IRC s) where
state :: (s -> (a, s)) -> IRC s a
state s -> (a, s)
f = do
TVar s
tvar <- (IRCState s -> TVar s) -> IRC s (TVar s)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks IRCState s -> TVar s
forall s. IRCState s -> TVar s
_userState
IO a -> IRC s a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> IRC s a) -> (STM a -> IO a) -> STM a -> IRC s a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. STM a -> IO a
forall a. STM a -> IO a
atomically (STM a -> IRC s a) -> STM a -> IRC s a
forall a b. (a -> b) -> a -> b
$ do
(a
a, s
s) <- s -> (a, s)
f (s -> (a, s)) -> STM s -> STM (a, s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TVar s -> STM s
forall a. TVar a -> STM a
readTVar TVar s
tvar
TVar s -> s -> STM ()
forall a. TVar a -> a -> STM ()
writeTVar TVar s
tvar s
s
a -> STM a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
a
get :: IRC s s
get = do
TVar s
tvar <- (IRCState s -> TVar s) -> IRC s (TVar s)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks IRCState s -> TVar s
forall s. IRCState s -> TVar s
_userState
IO s -> IRC s s
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO s -> IRC s s) -> IO s -> IRC s s
forall a b. (a -> b) -> a -> b
$ TVar s -> IO s
forall a. TVar a -> IO a
readTVarIO TVar s
tvar
put :: s -> IRC s ()
put s
s = do
TVar s
tvar <- (IRCState s -> TVar s) -> IRC s (TVar s)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks IRCState s -> TVar s
forall s. IRCState s -> TVar s
_userState
IO () -> IRC s ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> IRC s ()) -> IO () -> IRC s ()
forall a b. (a -> b) -> a -> b
$ STM () -> IO ()
forall a. STM a -> IO a
atomically (TVar s -> s -> STM ()
forall a. TVar a -> a -> STM ()
writeTVar TVar s
tvar s
s)
data IRCState s = IRCState
{ IRCState s -> ConnectionConfig s
_connectionConfig :: ConnectionConfig s
, IRCState s -> TVar s
_userState :: TVar s
, IRCState s -> TVar (InstanceConfig s)
_instanceConfig :: TVar (InstanceConfig s)
, IRCState s -> TVar (TBMChan (Message ByteString))
_sendqueue :: TVar (TBMChan (Message ByteString))
, IRCState s -> TVar ConnectionState
_connectionState :: TVar ConnectionState
, IRCState s -> TVar (Set ThreadId)
_runningThreads :: TVar (S.Set ThreadId)
}
data ConnectionConfig s = ConnectionConfig
{ ConnectionConfig s
-> IO ()
-> ConduitM (Either ByteString (Event ByteString)) Void IO ()
-> ConduitM () (Message ByteString) IO ()
-> IO ()
_func :: IO () -> ConduitM (Either ByteString (Event ByteString)) Void IO () -> ConduitM () (Message ByteString) IO () -> IO ()
, ConnectionConfig s -> ByteString
_server :: ByteString
, ConnectionConfig s -> Int
_port :: Int
, ConnectionConfig s -> Text
_username :: Text
, ConnectionConfig s -> Text
_realname :: Text
, ConnectionConfig s -> Maybe Text
_password :: Maybe Text
, ConnectionConfig s -> NominalDiffTime
_flood :: NominalDiffTime
, ConnectionConfig s -> NominalDiffTime
_timeout :: NominalDiffTime
, ConnectionConfig s -> IRC s ()
_onconnect :: IRC s ()
, ConnectionConfig s -> Maybe SomeException -> IRC s ()
_ondisconnect :: Maybe SomeException -> IRC s ()
, ConnectionConfig s -> Origin -> ByteString -> IO ()
_logfunc :: Origin -> ByteString -> IO ()
}
data InstanceConfig s = InstanceConfig
{ InstanceConfig s -> Text
_nick :: Text
, InstanceConfig s -> [Text]
_channels :: [Text]
, InstanceConfig s -> Text
_version :: Text
, InstanceConfig s -> [EventHandler s]
_handlers :: [EventHandler s]
, InstanceConfig s -> [(Text, Maybe Text)]
_ignore :: [(Text, Maybe Text)]
}
data ConnectionState = Connected | Disconnecting | Disconnected
deriving (ConnectionState
ConnectionState -> ConnectionState -> Bounded ConnectionState
forall a. a -> a -> Bounded a
maxBound :: ConnectionState
$cmaxBound :: ConnectionState
minBound :: ConnectionState
$cminBound :: ConnectionState
Bounded, Int -> ConnectionState
ConnectionState -> Int
ConnectionState -> [ConnectionState]
ConnectionState -> ConnectionState
ConnectionState -> ConnectionState -> [ConnectionState]
ConnectionState
-> ConnectionState -> ConnectionState -> [ConnectionState]
(ConnectionState -> ConnectionState)
-> (ConnectionState -> ConnectionState)
-> (Int -> ConnectionState)
-> (ConnectionState -> Int)
-> (ConnectionState -> [ConnectionState])
-> (ConnectionState -> ConnectionState -> [ConnectionState])
-> (ConnectionState -> ConnectionState -> [ConnectionState])
-> (ConnectionState
-> ConnectionState -> ConnectionState -> [ConnectionState])
-> Enum ConnectionState
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ConnectionState
-> ConnectionState -> ConnectionState -> [ConnectionState]
$cenumFromThenTo :: ConnectionState
-> ConnectionState -> ConnectionState -> [ConnectionState]
enumFromTo :: ConnectionState -> ConnectionState -> [ConnectionState]
$cenumFromTo :: ConnectionState -> ConnectionState -> [ConnectionState]
enumFromThen :: ConnectionState -> ConnectionState -> [ConnectionState]
$cenumFromThen :: ConnectionState -> ConnectionState -> [ConnectionState]
enumFrom :: ConnectionState -> [ConnectionState]
$cenumFrom :: ConnectionState -> [ConnectionState]
fromEnum :: ConnectionState -> Int
$cfromEnum :: ConnectionState -> Int
toEnum :: Int -> ConnectionState
$ctoEnum :: Int -> ConnectionState
pred :: ConnectionState -> ConnectionState
$cpred :: ConnectionState -> ConnectionState
succ :: ConnectionState -> ConnectionState
$csucc :: ConnectionState -> ConnectionState
Enum, ConnectionState -> ConnectionState -> Bool
(ConnectionState -> ConnectionState -> Bool)
-> (ConnectionState -> ConnectionState -> Bool)
-> Eq ConnectionState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionState -> ConnectionState -> Bool
$c/= :: ConnectionState -> ConnectionState -> Bool
== :: ConnectionState -> ConnectionState -> Bool
$c== :: ConnectionState -> ConnectionState -> Bool
Eq, Eq ConnectionState
Eq ConnectionState
-> (ConnectionState -> ConnectionState -> Ordering)
-> (ConnectionState -> ConnectionState -> Bool)
-> (ConnectionState -> ConnectionState -> Bool)
-> (ConnectionState -> ConnectionState -> Bool)
-> (ConnectionState -> ConnectionState -> Bool)
-> (ConnectionState -> ConnectionState -> ConnectionState)
-> (ConnectionState -> ConnectionState -> ConnectionState)
-> Ord ConnectionState
ConnectionState -> ConnectionState -> Bool
ConnectionState -> ConnectionState -> Ordering
ConnectionState -> ConnectionState -> ConnectionState
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ConnectionState -> ConnectionState -> ConnectionState
$cmin :: ConnectionState -> ConnectionState -> ConnectionState
max :: ConnectionState -> ConnectionState -> ConnectionState
$cmax :: ConnectionState -> ConnectionState -> ConnectionState
>= :: ConnectionState -> ConnectionState -> Bool
$c>= :: ConnectionState -> ConnectionState -> Bool
> :: ConnectionState -> ConnectionState -> Bool
$c> :: ConnectionState -> ConnectionState -> Bool
<= :: ConnectionState -> ConnectionState -> Bool
$c<= :: ConnectionState -> ConnectionState -> Bool
< :: ConnectionState -> ConnectionState -> Bool
$c< :: ConnectionState -> ConnectionState -> Bool
compare :: ConnectionState -> ConnectionState -> Ordering
$ccompare :: ConnectionState -> ConnectionState -> Ordering
$cp1Ord :: Eq ConnectionState
Ord, ReadPrec [ConnectionState]
ReadPrec ConnectionState
Int -> ReadS ConnectionState
ReadS [ConnectionState]
(Int -> ReadS ConnectionState)
-> ReadS [ConnectionState]
-> ReadPrec ConnectionState
-> ReadPrec [ConnectionState]
-> Read ConnectionState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionState]
$creadListPrec :: ReadPrec [ConnectionState]
readPrec :: ReadPrec ConnectionState
$creadPrec :: ReadPrec ConnectionState
readList :: ReadS [ConnectionState]
$creadList :: ReadS [ConnectionState]
readsPrec :: Int -> ReadS ConnectionState
$creadsPrec :: Int -> ReadS ConnectionState
Read, Int -> ConnectionState -> ShowS
[ConnectionState] -> ShowS
ConnectionState -> String
(Int -> ConnectionState -> ShowS)
-> (ConnectionState -> String)
-> ([ConnectionState] -> ShowS)
-> Show ConnectionState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionState] -> ShowS
$cshowList :: [ConnectionState] -> ShowS
show :: ConnectionState -> String
$cshow :: ConnectionState -> String
showsPrec :: Int -> ConnectionState -> ShowS
$cshowsPrec :: Int -> ConnectionState -> ShowS
Show)
data Origin = FromServer | FromClient
deriving (Origin
Origin -> Origin -> Bounded Origin
forall a. a -> a -> Bounded a
maxBound :: Origin
$cmaxBound :: Origin
minBound :: Origin
$cminBound :: Origin
Bounded, Int -> Origin
Origin -> Int
Origin -> [Origin]
Origin -> Origin
Origin -> Origin -> [Origin]
Origin -> Origin -> Origin -> [Origin]
(Origin -> Origin)
-> (Origin -> Origin)
-> (Int -> Origin)
-> (Origin -> Int)
-> (Origin -> [Origin])
-> (Origin -> Origin -> [Origin])
-> (Origin -> Origin -> [Origin])
-> (Origin -> Origin -> Origin -> [Origin])
-> Enum Origin
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Origin -> Origin -> Origin -> [Origin]
$cenumFromThenTo :: Origin -> Origin -> Origin -> [Origin]
enumFromTo :: Origin -> Origin -> [Origin]
$cenumFromTo :: Origin -> Origin -> [Origin]
enumFromThen :: Origin -> Origin -> [Origin]
$cenumFromThen :: Origin -> Origin -> [Origin]
enumFrom :: Origin -> [Origin]
$cenumFrom :: Origin -> [Origin]
fromEnum :: Origin -> Int
$cfromEnum :: Origin -> Int
toEnum :: Int -> Origin
$ctoEnum :: Int -> Origin
pred :: Origin -> Origin
$cpred :: Origin -> Origin
succ :: Origin -> Origin
$csucc :: Origin -> Origin
Enum, Origin -> Origin -> Bool
(Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool) -> Eq Origin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Origin -> Origin -> Bool
$c/= :: Origin -> Origin -> Bool
== :: Origin -> Origin -> Bool
$c== :: Origin -> Origin -> Bool
Eq, Eq Origin
Eq Origin
-> (Origin -> Origin -> Ordering)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool)
-> (Origin -> Origin -> Origin)
-> (Origin -> Origin -> Origin)
-> Ord Origin
Origin -> Origin -> Bool
Origin -> Origin -> Ordering
Origin -> Origin -> Origin
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Origin -> Origin -> Origin
$cmin :: Origin -> Origin -> Origin
max :: Origin -> Origin -> Origin
$cmax :: Origin -> Origin -> Origin
>= :: Origin -> Origin -> Bool
$c>= :: Origin -> Origin -> Bool
> :: Origin -> Origin -> Bool
$c> :: Origin -> Origin -> Bool
<= :: Origin -> Origin -> Bool
$c<= :: Origin -> Origin -> Bool
< :: Origin -> Origin -> Bool
$c< :: Origin -> Origin -> Bool
compare :: Origin -> Origin -> Ordering
$ccompare :: Origin -> Origin -> Ordering
$cp1Ord :: Eq Origin
Ord, ReadPrec [Origin]
ReadPrec Origin
Int -> ReadS Origin
ReadS [Origin]
(Int -> ReadS Origin)
-> ReadS [Origin]
-> ReadPrec Origin
-> ReadPrec [Origin]
-> Read Origin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Origin]
$creadListPrec :: ReadPrec [Origin]
readPrec :: ReadPrec Origin
$creadPrec :: ReadPrec Origin
readList :: ReadS [Origin]
$creadList :: ReadS [Origin]
readsPrec :: Int -> ReadS Origin
$creadsPrec :: Int -> ReadS Origin
Read, Int -> Origin -> ShowS
[Origin] -> ShowS
Origin -> String
(Int -> Origin -> ShowS)
-> (Origin -> String) -> ([Origin] -> ShowS) -> Show Origin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Origin] -> ShowS
$cshowList :: [Origin] -> ShowS
show :: Origin -> String
$cshow :: Origin -> String
showsPrec :: Int -> Origin -> ShowS
$cshowsPrec :: Int -> Origin -> ShowS
Show)
data EventHandler s where
EventHandler
:: (Event Text -> Maybe b)
-> (Source Text -> b -> IRC s ())
-> EventHandler s
data Timeout = Timeout
deriving (Timeout
Timeout -> Timeout -> Bounded Timeout
forall a. a -> a -> Bounded a
maxBound :: Timeout
$cmaxBound :: Timeout
minBound :: Timeout
$cminBound :: Timeout
Bounded, Int -> Timeout
Timeout -> Int
Timeout -> [Timeout]
Timeout -> Timeout
Timeout -> Timeout -> [Timeout]
Timeout -> Timeout -> Timeout -> [Timeout]
(Timeout -> Timeout)
-> (Timeout -> Timeout)
-> (Int -> Timeout)
-> (Timeout -> Int)
-> (Timeout -> [Timeout])
-> (Timeout -> Timeout -> [Timeout])
-> (Timeout -> Timeout -> [Timeout])
-> (Timeout -> Timeout -> Timeout -> [Timeout])
-> Enum Timeout
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Timeout -> Timeout -> Timeout -> [Timeout]
$cenumFromThenTo :: Timeout -> Timeout -> Timeout -> [Timeout]
enumFromTo :: Timeout -> Timeout -> [Timeout]
$cenumFromTo :: Timeout -> Timeout -> [Timeout]
enumFromThen :: Timeout -> Timeout -> [Timeout]
$cenumFromThen :: Timeout -> Timeout -> [Timeout]
enumFrom :: Timeout -> [Timeout]
$cenumFrom :: Timeout -> [Timeout]
fromEnum :: Timeout -> Int
$cfromEnum :: Timeout -> Int
toEnum :: Int -> Timeout
$ctoEnum :: Int -> Timeout
pred :: Timeout -> Timeout
$cpred :: Timeout -> Timeout
succ :: Timeout -> Timeout
$csucc :: Timeout -> Timeout
Enum, Timeout -> Timeout -> Bool
(Timeout -> Timeout -> Bool)
-> (Timeout -> Timeout -> Bool) -> Eq Timeout
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Timeout -> Timeout -> Bool
$c/= :: Timeout -> Timeout -> Bool
== :: Timeout -> Timeout -> Bool
$c== :: Timeout -> Timeout -> Bool
Eq, Eq Timeout
Eq Timeout
-> (Timeout -> Timeout -> Ordering)
-> (Timeout -> Timeout -> Bool)
-> (Timeout -> Timeout -> Bool)
-> (Timeout -> Timeout -> Bool)
-> (Timeout -> Timeout -> Bool)
-> (Timeout -> Timeout -> Timeout)
-> (Timeout -> Timeout -> Timeout)
-> Ord Timeout
Timeout -> Timeout -> Bool
Timeout -> Timeout -> Ordering
Timeout -> Timeout -> Timeout
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Timeout -> Timeout -> Timeout
$cmin :: Timeout -> Timeout -> Timeout
max :: Timeout -> Timeout -> Timeout
$cmax :: Timeout -> Timeout -> Timeout
>= :: Timeout -> Timeout -> Bool
$c>= :: Timeout -> Timeout -> Bool
> :: Timeout -> Timeout -> Bool
$c> :: Timeout -> Timeout -> Bool
<= :: Timeout -> Timeout -> Bool
$c<= :: Timeout -> Timeout -> Bool
< :: Timeout -> Timeout -> Bool
$c< :: Timeout -> Timeout -> Bool
compare :: Timeout -> Timeout -> Ordering
$ccompare :: Timeout -> Timeout -> Ordering
$cp1Ord :: Eq Timeout
Ord, ReadPrec [Timeout]
ReadPrec Timeout
Int -> ReadS Timeout
ReadS [Timeout]
(Int -> ReadS Timeout)
-> ReadS [Timeout]
-> ReadPrec Timeout
-> ReadPrec [Timeout]
-> Read Timeout
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Timeout]
$creadListPrec :: ReadPrec [Timeout]
readPrec :: ReadPrec Timeout
$creadPrec :: ReadPrec Timeout
readList :: ReadS [Timeout]
$creadList :: ReadS [Timeout]
readsPrec :: Int -> ReadS Timeout
$creadsPrec :: Int -> ReadS Timeout
Read, Int -> Timeout -> ShowS
[Timeout] -> ShowS
Timeout -> String
(Int -> Timeout -> ShowS)
-> (Timeout -> String) -> ([Timeout] -> ShowS) -> Show Timeout
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Timeout] -> ShowS
$cshowList :: [Timeout] -> ShowS
show :: Timeout -> String
$cshow :: Timeout -> String
showsPrec :: Int -> Timeout -> ShowS
$cshowsPrec :: Int -> Timeout -> ShowS
Show)
instance Exception Timeout
data Disconnect = Disconnect
deriving (Disconnect
Disconnect -> Disconnect -> Bounded Disconnect
forall a. a -> a -> Bounded a
maxBound :: Disconnect
$cmaxBound :: Disconnect
minBound :: Disconnect
$cminBound :: Disconnect
Bounded, Int -> Disconnect
Disconnect -> Int
Disconnect -> [Disconnect]
Disconnect -> Disconnect
Disconnect -> Disconnect -> [Disconnect]
Disconnect -> Disconnect -> Disconnect -> [Disconnect]
(Disconnect -> Disconnect)
-> (Disconnect -> Disconnect)
-> (Int -> Disconnect)
-> (Disconnect -> Int)
-> (Disconnect -> [Disconnect])
-> (Disconnect -> Disconnect -> [Disconnect])
-> (Disconnect -> Disconnect -> [Disconnect])
-> (Disconnect -> Disconnect -> Disconnect -> [Disconnect])
-> Enum Disconnect
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Disconnect -> Disconnect -> Disconnect -> [Disconnect]
$cenumFromThenTo :: Disconnect -> Disconnect -> Disconnect -> [Disconnect]
enumFromTo :: Disconnect -> Disconnect -> [Disconnect]
$cenumFromTo :: Disconnect -> Disconnect -> [Disconnect]
enumFromThen :: Disconnect -> Disconnect -> [Disconnect]
$cenumFromThen :: Disconnect -> Disconnect -> [Disconnect]
enumFrom :: Disconnect -> [Disconnect]
$cenumFrom :: Disconnect -> [Disconnect]
fromEnum :: Disconnect -> Int
$cfromEnum :: Disconnect -> Int
toEnum :: Int -> Disconnect
$ctoEnum :: Int -> Disconnect
pred :: Disconnect -> Disconnect
$cpred :: Disconnect -> Disconnect
succ :: Disconnect -> Disconnect
$csucc :: Disconnect -> Disconnect
Enum, Disconnect -> Disconnect -> Bool
(Disconnect -> Disconnect -> Bool)
-> (Disconnect -> Disconnect -> Bool) -> Eq Disconnect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Disconnect -> Disconnect -> Bool
$c/= :: Disconnect -> Disconnect -> Bool
== :: Disconnect -> Disconnect -> Bool
$c== :: Disconnect -> Disconnect -> Bool
Eq, Eq Disconnect
Eq Disconnect
-> (Disconnect -> Disconnect -> Ordering)
-> (Disconnect -> Disconnect -> Bool)
-> (Disconnect -> Disconnect -> Bool)
-> (Disconnect -> Disconnect -> Bool)
-> (Disconnect -> Disconnect -> Bool)
-> (Disconnect -> Disconnect -> Disconnect)
-> (Disconnect -> Disconnect -> Disconnect)
-> Ord Disconnect
Disconnect -> Disconnect -> Bool
Disconnect -> Disconnect -> Ordering
Disconnect -> Disconnect -> Disconnect
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Disconnect -> Disconnect -> Disconnect
$cmin :: Disconnect -> Disconnect -> Disconnect
max :: Disconnect -> Disconnect -> Disconnect
$cmax :: Disconnect -> Disconnect -> Disconnect
>= :: Disconnect -> Disconnect -> Bool
$c>= :: Disconnect -> Disconnect -> Bool
> :: Disconnect -> Disconnect -> Bool
$c> :: Disconnect -> Disconnect -> Bool
<= :: Disconnect -> Disconnect -> Bool
$c<= :: Disconnect -> Disconnect -> Bool
< :: Disconnect -> Disconnect -> Bool
$c< :: Disconnect -> Disconnect -> Bool
compare :: Disconnect -> Disconnect -> Ordering
$ccompare :: Disconnect -> Disconnect -> Ordering
$cp1Ord :: Eq Disconnect
Ord, ReadPrec [Disconnect]
ReadPrec Disconnect
Int -> ReadS Disconnect
ReadS [Disconnect]
(Int -> ReadS Disconnect)
-> ReadS [Disconnect]
-> ReadPrec Disconnect
-> ReadPrec [Disconnect]
-> Read Disconnect
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Disconnect]
$creadListPrec :: ReadPrec [Disconnect]
readPrec :: ReadPrec Disconnect
$creadPrec :: ReadPrec Disconnect
readList :: ReadS [Disconnect]
$creadList :: ReadS [Disconnect]
readsPrec :: Int -> ReadS Disconnect
$creadsPrec :: Int -> ReadS Disconnect
Read, Int -> Disconnect -> ShowS
[Disconnect] -> ShowS
Disconnect -> String
(Int -> Disconnect -> ShowS)
-> (Disconnect -> String)
-> ([Disconnect] -> ShowS)
-> Show Disconnect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Disconnect] -> ShowS
$cshowList :: [Disconnect] -> ShowS
show :: Disconnect -> String
$cshow :: Disconnect -> String
showsPrec :: Int -> Disconnect -> ShowS
$cshowsPrec :: Int -> Disconnect -> ShowS
Show)
instance Exception Disconnect