{-# LANGUAGE DeriveGeneric #-}
module Network.Transport
(
Transport(..)
, EndPoint(..)
, Connection(..)
, Event(..)
, ConnectionId
, Reliability(..)
, MulticastGroup(..)
, EndPointAddress(..)
, MulticastAddress(..)
, ConnectHints(..)
, defaultConnectHints
, TransportError(..)
, NewEndPointErrorCode(..)
, ConnectErrorCode(..)
, NewMulticastGroupErrorCode(..)
, ResolveMulticastGroupErrorCode(..)
, SendErrorCode(..)
, EventErrorCode(..)
) where
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS (copy)
import qualified Data.ByteString.Char8 as BSC (unpack)
import Control.DeepSeq (NFData(rnf))
import Control.Exception (Exception)
import Data.Typeable (Typeable)
import Data.Binary (Binary(..))
import Data.Hashable
import Data.Word (Word64)
import Data.Data (Data)
import GHC.Generics (Generic)
data Transport = Transport {
Transport
-> IO (Either (TransportError NewEndPointErrorCode) EndPoint)
newEndPoint :: IO (Either (TransportError NewEndPointErrorCode) EndPoint)
, Transport -> IO ()
closeTransport :: IO ()
}
data EndPoint = EndPoint {
EndPoint -> IO Event
receive :: IO Event
, EndPoint -> EndPointAddress
address :: EndPointAddress
, EndPoint
-> EndPointAddress
-> Reliability
-> ConnectHints
-> IO (Either (TransportError ConnectErrorCode) Connection)
connect :: EndPointAddress -> Reliability -> ConnectHints -> IO (Either (TransportError ConnectErrorCode) Connection)
, EndPoint
-> IO
(Either (TransportError NewMulticastGroupErrorCode) MulticastGroup)
newMulticastGroup :: IO (Either (TransportError NewMulticastGroupErrorCode) MulticastGroup)
, EndPoint
-> MulticastAddress
-> IO
(Either
(TransportError ResolveMulticastGroupErrorCode) MulticastGroup)
resolveMulticastGroup :: MulticastAddress -> IO (Either (TransportError ResolveMulticastGroupErrorCode) MulticastGroup)
, EndPoint -> IO ()
closeEndPoint :: IO ()
}
data Connection = Connection {
Connection
-> [ByteString] -> IO (Either (TransportError SendErrorCode) ())
send :: [ByteString] -> IO (Either (TransportError SendErrorCode) ())
, Connection -> IO ()
close :: IO ()
}
data Event =
Received {-# UNPACK #-} !ConnectionId [ByteString]
| ConnectionClosed {-# UNPACK #-} !ConnectionId
| ConnectionOpened {-# UNPACK #-} !ConnectionId Reliability EndPointAddress
| ReceivedMulticast MulticastAddress [ByteString]
| EndPointClosed
| ErrorEvent (TransportError EventErrorCode)
deriving (Int -> Event -> ShowS
[Event] -> ShowS
Event -> String
(Int -> Event -> ShowS)
-> (Event -> String) -> ([Event] -> ShowS) -> Show Event
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Event -> ShowS
showsPrec :: Int -> Event -> ShowS
$cshow :: Event -> String
show :: Event -> String
$cshowList :: [Event] -> ShowS
showList :: [Event] -> ShowS
Show, Event -> Event -> Bool
(Event -> Event -> Bool) -> (Event -> Event -> Bool) -> Eq Event
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Event -> Event -> Bool
== :: Event -> Event -> Bool
$c/= :: Event -> Event -> Bool
/= :: Event -> Event -> Bool
Eq, (forall x. Event -> Rep Event x)
-> (forall x. Rep Event x -> Event) -> Generic Event
forall x. Rep Event x -> Event
forall x. Event -> Rep Event x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Event -> Rep Event x
from :: forall x. Event -> Rep Event x
$cto :: forall x. Rep Event x -> Event
to :: forall x. Rep Event x -> Event
Generic)
instance Binary Event
type ConnectionId = Word64
data Reliability =
ReliableOrdered
| ReliableUnordered
| Unreliable
deriving (Int -> Reliability -> ShowS
[Reliability] -> ShowS
Reliability -> String
(Int -> Reliability -> ShowS)
-> (Reliability -> String)
-> ([Reliability] -> ShowS)
-> Show Reliability
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Reliability -> ShowS
showsPrec :: Int -> Reliability -> ShowS
$cshow :: Reliability -> String
show :: Reliability -> String
$cshowList :: [Reliability] -> ShowS
showList :: [Reliability] -> ShowS
Show, Reliability -> Reliability -> Bool
(Reliability -> Reliability -> Bool)
-> (Reliability -> Reliability -> Bool) -> Eq Reliability
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Reliability -> Reliability -> Bool
== :: Reliability -> Reliability -> Bool
$c/= :: Reliability -> Reliability -> Bool
/= :: Reliability -> Reliability -> Bool
Eq, Typeable, (forall x. Reliability -> Rep Reliability x)
-> (forall x. Rep Reliability x -> Reliability)
-> Generic Reliability
forall x. Rep Reliability x -> Reliability
forall x. Reliability -> Rep Reliability x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Reliability -> Rep Reliability x
from :: forall x. Reliability -> Rep Reliability x
$cto :: forall x. Rep Reliability x -> Reliability
to :: forall x. Rep Reliability x -> Reliability
Generic)
instance Binary Reliability
data MulticastGroup = MulticastGroup {
MulticastGroup -> MulticastAddress
multicastAddress :: MulticastAddress
, MulticastGroup -> IO ()
deleteMulticastGroup :: IO ()
, MulticastGroup -> Maybe Int
maxMsgSize :: Maybe Int
, MulticastGroup -> [ByteString] -> IO ()
multicastSend :: [ByteString] -> IO ()
, MulticastGroup -> IO ()
multicastSubscribe :: IO ()
, MulticastGroup -> IO ()
multicastUnsubscribe :: IO ()
, MulticastGroup -> IO ()
multicastClose :: IO ()
}
newtype EndPointAddress = EndPointAddress { EndPointAddress -> ByteString
endPointAddressToByteString :: ByteString }
deriving (EndPointAddress -> EndPointAddress -> Bool
(EndPointAddress -> EndPointAddress -> Bool)
-> (EndPointAddress -> EndPointAddress -> Bool)
-> Eq EndPointAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EndPointAddress -> EndPointAddress -> Bool
== :: EndPointAddress -> EndPointAddress -> Bool
$c/= :: EndPointAddress -> EndPointAddress -> Bool
/= :: EndPointAddress -> EndPointAddress -> Bool
Eq, Eq EndPointAddress
Eq EndPointAddress =>
(EndPointAddress -> EndPointAddress -> Ordering)
-> (EndPointAddress -> EndPointAddress -> Bool)
-> (EndPointAddress -> EndPointAddress -> Bool)
-> (EndPointAddress -> EndPointAddress -> Bool)
-> (EndPointAddress -> EndPointAddress -> Bool)
-> (EndPointAddress -> EndPointAddress -> EndPointAddress)
-> (EndPointAddress -> EndPointAddress -> EndPointAddress)
-> Ord EndPointAddress
EndPointAddress -> EndPointAddress -> Bool
EndPointAddress -> EndPointAddress -> Ordering
EndPointAddress -> EndPointAddress -> EndPointAddress
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
$ccompare :: EndPointAddress -> EndPointAddress -> Ordering
compare :: EndPointAddress -> EndPointAddress -> Ordering
$c< :: EndPointAddress -> EndPointAddress -> Bool
< :: EndPointAddress -> EndPointAddress -> Bool
$c<= :: EndPointAddress -> EndPointAddress -> Bool
<= :: EndPointAddress -> EndPointAddress -> Bool
$c> :: EndPointAddress -> EndPointAddress -> Bool
> :: EndPointAddress -> EndPointAddress -> Bool
$c>= :: EndPointAddress -> EndPointAddress -> Bool
>= :: EndPointAddress -> EndPointAddress -> Bool
$cmax :: EndPointAddress -> EndPointAddress -> EndPointAddress
max :: EndPointAddress -> EndPointAddress -> EndPointAddress
$cmin :: EndPointAddress -> EndPointAddress -> EndPointAddress
min :: EndPointAddress -> EndPointAddress -> EndPointAddress
Ord, Typeable, Typeable EndPointAddress
Typeable EndPointAddress =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EndPointAddress -> c EndPointAddress)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EndPointAddress)
-> (EndPointAddress -> Constr)
-> (EndPointAddress -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EndPointAddress))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EndPointAddress))
-> ((forall b. Data b => b -> b)
-> EndPointAddress -> EndPointAddress)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r)
-> (forall u.
(forall d. Data d => d -> u) -> EndPointAddress -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> EndPointAddress -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress)
-> Data EndPointAddress
EndPointAddress -> Constr
EndPointAddress -> DataType
(forall b. Data b => b -> b) -> EndPointAddress -> EndPointAddress
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> EndPointAddress -> u
forall u. (forall d. Data d => d -> u) -> EndPointAddress -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EndPointAddress
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EndPointAddress -> c EndPointAddress
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EndPointAddress)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EndPointAddress)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EndPointAddress -> c EndPointAddress
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EndPointAddress -> c EndPointAddress
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EndPointAddress
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EndPointAddress
$ctoConstr :: EndPointAddress -> Constr
toConstr :: EndPointAddress -> Constr
$cdataTypeOf :: EndPointAddress -> DataType
dataTypeOf :: EndPointAddress -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EndPointAddress)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EndPointAddress)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EndPointAddress)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EndPointAddress)
$cgmapT :: (forall b. Data b => b -> b) -> EndPointAddress -> EndPointAddress
gmapT :: (forall b. Data b => b -> b) -> EndPointAddress -> EndPointAddress
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EndPointAddress -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EndPointAddress -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> EndPointAddress -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> EndPointAddress -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> EndPointAddress -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EndPointAddress -> m EndPointAddress
Data, Eq EndPointAddress
Eq EndPointAddress =>
(Int -> EndPointAddress -> Int)
-> (EndPointAddress -> Int) -> Hashable EndPointAddress
Int -> EndPointAddress -> Int
EndPointAddress -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> EndPointAddress -> Int
hashWithSalt :: Int -> EndPointAddress -> Int
$chash :: EndPointAddress -> Int
hash :: EndPointAddress -> Int
Hashable)
instance Binary EndPointAddress where
put :: EndPointAddress -> Put
put = ByteString -> Put
forall t. Binary t => t -> Put
put (ByteString -> Put)
-> (EndPointAddress -> ByteString) -> EndPointAddress -> Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EndPointAddress -> ByteString
endPointAddressToByteString
get :: Get EndPointAddress
get = ByteString -> EndPointAddress
EndPointAddress (ByteString -> EndPointAddress)
-> (ByteString -> ByteString) -> ByteString -> EndPointAddress
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
BS.copy (ByteString -> EndPointAddress)
-> Get ByteString -> Get EndPointAddress
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get ByteString
forall t. Binary t => Get t
get
instance Show EndPointAddress where
show :: EndPointAddress -> String
show = ByteString -> String
BSC.unpack (ByteString -> String)
-> (EndPointAddress -> ByteString) -> EndPointAddress -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EndPointAddress -> ByteString
endPointAddressToByteString
instance NFData EndPointAddress where rnf :: EndPointAddress -> ()
rnf EndPointAddress
x = EndPointAddress
x EndPointAddress -> () -> ()
forall a b. a -> b -> b
`seq` ()
newtype MulticastAddress = MulticastAddress { MulticastAddress -> ByteString
multicastAddressToByteString :: ByteString }
deriving (MulticastAddress -> MulticastAddress -> Bool
(MulticastAddress -> MulticastAddress -> Bool)
-> (MulticastAddress -> MulticastAddress -> Bool)
-> Eq MulticastAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MulticastAddress -> MulticastAddress -> Bool
== :: MulticastAddress -> MulticastAddress -> Bool
$c/= :: MulticastAddress -> MulticastAddress -> Bool
/= :: MulticastAddress -> MulticastAddress -> Bool
Eq, Eq MulticastAddress
Eq MulticastAddress =>
(MulticastAddress -> MulticastAddress -> Ordering)
-> (MulticastAddress -> MulticastAddress -> Bool)
-> (MulticastAddress -> MulticastAddress -> Bool)
-> (MulticastAddress -> MulticastAddress -> Bool)
-> (MulticastAddress -> MulticastAddress -> Bool)
-> (MulticastAddress -> MulticastAddress -> MulticastAddress)
-> (MulticastAddress -> MulticastAddress -> MulticastAddress)
-> Ord MulticastAddress
MulticastAddress -> MulticastAddress -> Bool
MulticastAddress -> MulticastAddress -> Ordering
MulticastAddress -> MulticastAddress -> MulticastAddress
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
$ccompare :: MulticastAddress -> MulticastAddress -> Ordering
compare :: MulticastAddress -> MulticastAddress -> Ordering
$c< :: MulticastAddress -> MulticastAddress -> Bool
< :: MulticastAddress -> MulticastAddress -> Bool
$c<= :: MulticastAddress -> MulticastAddress -> Bool
<= :: MulticastAddress -> MulticastAddress -> Bool
$c> :: MulticastAddress -> MulticastAddress -> Bool
> :: MulticastAddress -> MulticastAddress -> Bool
$c>= :: MulticastAddress -> MulticastAddress -> Bool
>= :: MulticastAddress -> MulticastAddress -> Bool
$cmax :: MulticastAddress -> MulticastAddress -> MulticastAddress
max :: MulticastAddress -> MulticastAddress -> MulticastAddress
$cmin :: MulticastAddress -> MulticastAddress -> MulticastAddress
min :: MulticastAddress -> MulticastAddress -> MulticastAddress
Ord, (forall x. MulticastAddress -> Rep MulticastAddress x)
-> (forall x. Rep MulticastAddress x -> MulticastAddress)
-> Generic MulticastAddress
forall x. Rep MulticastAddress x -> MulticastAddress
forall x. MulticastAddress -> Rep MulticastAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MulticastAddress -> Rep MulticastAddress x
from :: forall x. MulticastAddress -> Rep MulticastAddress x
$cto :: forall x. Rep MulticastAddress x -> MulticastAddress
to :: forall x. Rep MulticastAddress x -> MulticastAddress
Generic)
instance Binary MulticastAddress
instance Show MulticastAddress where
show :: MulticastAddress -> String
show = ByteString -> String
forall a. Show a => a -> String
show (ByteString -> String)
-> (MulticastAddress -> ByteString) -> MulticastAddress -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MulticastAddress -> ByteString
multicastAddressToByteString
data ConnectHints = ConnectHints {
ConnectHints -> Maybe Int
connectTimeout :: Maybe Int
}
defaultConnectHints :: ConnectHints
defaultConnectHints :: ConnectHints
defaultConnectHints = ConnectHints {
connectTimeout :: Maybe Int
connectTimeout = Maybe Int
forall a. Maybe a
Nothing
}
data TransportError error = TransportError error String
deriving (Int -> TransportError error -> ShowS
[TransportError error] -> ShowS
TransportError error -> String
(Int -> TransportError error -> ShowS)
-> (TransportError error -> String)
-> ([TransportError error] -> ShowS)
-> Show (TransportError error)
forall error. Show error => Int -> TransportError error -> ShowS
forall error. Show error => [TransportError error] -> ShowS
forall error. Show error => TransportError error -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall error. Show error => Int -> TransportError error -> ShowS
showsPrec :: Int -> TransportError error -> ShowS
$cshow :: forall error. Show error => TransportError error -> String
show :: TransportError error -> String
$cshowList :: forall error. Show error => [TransportError error] -> ShowS
showList :: [TransportError error] -> ShowS
Show, Typeable, (forall x. TransportError error -> Rep (TransportError error) x)
-> (forall x. Rep (TransportError error) x -> TransportError error)
-> Generic (TransportError error)
forall x. Rep (TransportError error) x -> TransportError error
forall x. TransportError error -> Rep (TransportError error) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall error x.
Rep (TransportError error) x -> TransportError error
forall error x.
TransportError error -> Rep (TransportError error) x
$cfrom :: forall error x.
TransportError error -> Rep (TransportError error) x
from :: forall x. TransportError error -> Rep (TransportError error) x
$cto :: forall error x.
Rep (TransportError error) x -> TransportError error
to :: forall x. Rep (TransportError error) x -> TransportError error
Generic)
instance (Binary error) => Binary (TransportError error)
instance (Typeable err, Show err) => Exception (TransportError err)
instance Eq error => Eq (TransportError error) where
TransportError error
err1 String
_ == :: TransportError error -> TransportError error -> Bool
== TransportError error
err2 String
_ = error
err1 error -> error -> Bool
forall a. Eq a => a -> a -> Bool
== error
err2
data NewEndPointErrorCode =
NewEndPointInsufficientResources
| NewEndPointFailed
deriving (Int -> NewEndPointErrorCode -> ShowS
[NewEndPointErrorCode] -> ShowS
NewEndPointErrorCode -> String
(Int -> NewEndPointErrorCode -> ShowS)
-> (NewEndPointErrorCode -> String)
-> ([NewEndPointErrorCode] -> ShowS)
-> Show NewEndPointErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NewEndPointErrorCode -> ShowS
showsPrec :: Int -> NewEndPointErrorCode -> ShowS
$cshow :: NewEndPointErrorCode -> String
show :: NewEndPointErrorCode -> String
$cshowList :: [NewEndPointErrorCode] -> ShowS
showList :: [NewEndPointErrorCode] -> ShowS
Show, Typeable, NewEndPointErrorCode -> NewEndPointErrorCode -> Bool
(NewEndPointErrorCode -> NewEndPointErrorCode -> Bool)
-> (NewEndPointErrorCode -> NewEndPointErrorCode -> Bool)
-> Eq NewEndPointErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NewEndPointErrorCode -> NewEndPointErrorCode -> Bool
== :: NewEndPointErrorCode -> NewEndPointErrorCode -> Bool
$c/= :: NewEndPointErrorCode -> NewEndPointErrorCode -> Bool
/= :: NewEndPointErrorCode -> NewEndPointErrorCode -> Bool
Eq)
data ConnectErrorCode =
ConnectNotFound
| ConnectInsufficientResources
| ConnectTimeout
| ConnectFailed
deriving (Int -> ConnectErrorCode -> ShowS
[ConnectErrorCode] -> ShowS
ConnectErrorCode -> String
(Int -> ConnectErrorCode -> ShowS)
-> (ConnectErrorCode -> String)
-> ([ConnectErrorCode] -> ShowS)
-> Show ConnectErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConnectErrorCode -> ShowS
showsPrec :: Int -> ConnectErrorCode -> ShowS
$cshow :: ConnectErrorCode -> String
show :: ConnectErrorCode -> String
$cshowList :: [ConnectErrorCode] -> ShowS
showList :: [ConnectErrorCode] -> ShowS
Show, Typeable, ConnectErrorCode -> ConnectErrorCode -> Bool
(ConnectErrorCode -> ConnectErrorCode -> Bool)
-> (ConnectErrorCode -> ConnectErrorCode -> Bool)
-> Eq ConnectErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConnectErrorCode -> ConnectErrorCode -> Bool
== :: ConnectErrorCode -> ConnectErrorCode -> Bool
$c/= :: ConnectErrorCode -> ConnectErrorCode -> Bool
/= :: ConnectErrorCode -> ConnectErrorCode -> Bool
Eq)
data NewMulticastGroupErrorCode =
NewMulticastGroupInsufficientResources
| NewMulticastGroupFailed
| NewMulticastGroupUnsupported
deriving (Int -> NewMulticastGroupErrorCode -> ShowS
[NewMulticastGroupErrorCode] -> ShowS
NewMulticastGroupErrorCode -> String
(Int -> NewMulticastGroupErrorCode -> ShowS)
-> (NewMulticastGroupErrorCode -> String)
-> ([NewMulticastGroupErrorCode] -> ShowS)
-> Show NewMulticastGroupErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NewMulticastGroupErrorCode -> ShowS
showsPrec :: Int -> NewMulticastGroupErrorCode -> ShowS
$cshow :: NewMulticastGroupErrorCode -> String
show :: NewMulticastGroupErrorCode -> String
$cshowList :: [NewMulticastGroupErrorCode] -> ShowS
showList :: [NewMulticastGroupErrorCode] -> ShowS
Show, Typeable, NewMulticastGroupErrorCode -> NewMulticastGroupErrorCode -> Bool
(NewMulticastGroupErrorCode -> NewMulticastGroupErrorCode -> Bool)
-> (NewMulticastGroupErrorCode
-> NewMulticastGroupErrorCode -> Bool)
-> Eq NewMulticastGroupErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NewMulticastGroupErrorCode -> NewMulticastGroupErrorCode -> Bool
== :: NewMulticastGroupErrorCode -> NewMulticastGroupErrorCode -> Bool
$c/= :: NewMulticastGroupErrorCode -> NewMulticastGroupErrorCode -> Bool
/= :: NewMulticastGroupErrorCode -> NewMulticastGroupErrorCode -> Bool
Eq)
data ResolveMulticastGroupErrorCode =
ResolveMulticastGroupNotFound
| ResolveMulticastGroupFailed
| ResolveMulticastGroupUnsupported
deriving (Int -> ResolveMulticastGroupErrorCode -> ShowS
[ResolveMulticastGroupErrorCode] -> ShowS
ResolveMulticastGroupErrorCode -> String
(Int -> ResolveMulticastGroupErrorCode -> ShowS)
-> (ResolveMulticastGroupErrorCode -> String)
-> ([ResolveMulticastGroupErrorCode] -> ShowS)
-> Show ResolveMulticastGroupErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResolveMulticastGroupErrorCode -> ShowS
showsPrec :: Int -> ResolveMulticastGroupErrorCode -> ShowS
$cshow :: ResolveMulticastGroupErrorCode -> String
show :: ResolveMulticastGroupErrorCode -> String
$cshowList :: [ResolveMulticastGroupErrorCode] -> ShowS
showList :: [ResolveMulticastGroupErrorCode] -> ShowS
Show, Typeable, ResolveMulticastGroupErrorCode
-> ResolveMulticastGroupErrorCode -> Bool
(ResolveMulticastGroupErrorCode
-> ResolveMulticastGroupErrorCode -> Bool)
-> (ResolveMulticastGroupErrorCode
-> ResolveMulticastGroupErrorCode -> Bool)
-> Eq ResolveMulticastGroupErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ResolveMulticastGroupErrorCode
-> ResolveMulticastGroupErrorCode -> Bool
== :: ResolveMulticastGroupErrorCode
-> ResolveMulticastGroupErrorCode -> Bool
$c/= :: ResolveMulticastGroupErrorCode
-> ResolveMulticastGroupErrorCode -> Bool
/= :: ResolveMulticastGroupErrorCode
-> ResolveMulticastGroupErrorCode -> Bool
Eq)
data SendErrorCode =
SendClosed
| SendFailed
deriving (Int -> SendErrorCode -> ShowS
[SendErrorCode] -> ShowS
SendErrorCode -> String
(Int -> SendErrorCode -> ShowS)
-> (SendErrorCode -> String)
-> ([SendErrorCode] -> ShowS)
-> Show SendErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendErrorCode -> ShowS
showsPrec :: Int -> SendErrorCode -> ShowS
$cshow :: SendErrorCode -> String
show :: SendErrorCode -> String
$cshowList :: [SendErrorCode] -> ShowS
showList :: [SendErrorCode] -> ShowS
Show, Typeable, SendErrorCode -> SendErrorCode -> Bool
(SendErrorCode -> SendErrorCode -> Bool)
-> (SendErrorCode -> SendErrorCode -> Bool) -> Eq SendErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendErrorCode -> SendErrorCode -> Bool
== :: SendErrorCode -> SendErrorCode -> Bool
$c/= :: SendErrorCode -> SendErrorCode -> Bool
/= :: SendErrorCode -> SendErrorCode -> Bool
Eq)
data EventErrorCode =
EventEndPointFailed
| EventTransportFailed
| EventConnectionLost EndPointAddress
deriving (Int -> EventErrorCode -> ShowS
[EventErrorCode] -> ShowS
EventErrorCode -> String
(Int -> EventErrorCode -> ShowS)
-> (EventErrorCode -> String)
-> ([EventErrorCode] -> ShowS)
-> Show EventErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EventErrorCode -> ShowS
showsPrec :: Int -> EventErrorCode -> ShowS
$cshow :: EventErrorCode -> String
show :: EventErrorCode -> String
$cshowList :: [EventErrorCode] -> ShowS
showList :: [EventErrorCode] -> ShowS
Show, Typeable, EventErrorCode -> EventErrorCode -> Bool
(EventErrorCode -> EventErrorCode -> Bool)
-> (EventErrorCode -> EventErrorCode -> Bool) -> Eq EventErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EventErrorCode -> EventErrorCode -> Bool
== :: EventErrorCode -> EventErrorCode -> Bool
$c/= :: EventErrorCode -> EventErrorCode -> Bool
/= :: EventErrorCode -> EventErrorCode -> Bool
Eq, (forall x. EventErrorCode -> Rep EventErrorCode x)
-> (forall x. Rep EventErrorCode x -> EventErrorCode)
-> Generic EventErrorCode
forall x. Rep EventErrorCode x -> EventErrorCode
forall x. EventErrorCode -> Rep EventErrorCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. EventErrorCode -> Rep EventErrorCode x
from :: forall x. EventErrorCode -> Rep EventErrorCode x
$cto :: forall x. Rep EventErrorCode x -> EventErrorCode
to :: forall x. Rep EventErrorCode x -> EventErrorCode
Generic)
instance Binary EventErrorCode