@@ -23,10 +23,12 @@ module Network.Transport ( -- * Types
25import Data.ByteString (ByteString)
25import Data.ByteString (ByteString)
26+import qualified Data.ByteString as BS (copy)
26import qualified Data.ByteString.Char8 as BSC (unpack)
27import qualified Data.ByteString.Char8 as BSC (unpack)
27import Control.Exception (Exception)
28import Control.Exception (Exception)
29+import Control.Applicative ((<$>))
28import Data.Typeable (Typeable)
30import Data.Typeable (Typeable)
29−import Data.Binary (Binary)
31+import Data.Binary (Binary(get, put))
31--------------------------------------------------------------------------------
33--------------------------------------------------------------------------------
32-- Main API --
34-- Main API --
@@ -116,7 +118,11 @@ data MulticastGroup = MulticastGroup {
117-- | EndPointAddress of an endpoint.
119-- | EndPointAddress of an endpoint.
118newtype EndPointAddress = EndPointAddress { endPointAddressToByteString :: ByteString }
120newtype EndPointAddress = EndPointAddress { endPointAddressToByteString :: ByteString }
119− deriving (Eq, Ord, Typeable, Binary)
121+ deriving (Eq, Ord, Typeable)
123+instance Binary EndPointAddress where
124+ put = put . endPointAddressToByteString
125+ get = EndPointAddress . BS.copy <$> get
121instance Show EndPointAddress where
127instance Show EndPointAddress where
122 show = BSC.unpack . endPointAddressToByteString
128 show = BSC.unpack . endPointAddressToByteString