@@ -23,10 +23,12 @@ module Network.Transport ( -- * Types
2323 ) where
2424
2525import Data.ByteString (ByteString)
26+import qualified Data.ByteString as BS (copy)
2627import qualified Data.ByteString.Char8 as BSC (unpack)
2728import Control.Exception (Exception)
29+import Control.Applicative ((<$>))
2830import Data.Typeable (Typeable)
29−import Data.Binary (Binary)
31+import Data.Binary (Binary(get, put))
3032
3133--------------------------------------------------------------------------------
3234-- Main API --
@@ -116,7 +118,11 @@ data MulticastGroup = MulticastGroup {
116118
117119-- | EndPointAddress of an endpoint.
118120newtype EndPointAddress = EndPointAddress { endPointAddressToByteString :: ByteString }
119− deriving (Eq, Ord, Typeable, Binary)
121+ deriving (Eq, Ord, Typeable)
122+
123+instance Binary EndPointAddress where
124+ put = put . endPointAddressToByteString
125+ get = EndPointAddress . BS.copy <$> get
120126
121127instance Show EndPointAddress where
122128 show = BSC.unpack . endPointAddressToByteString