@@ -77,7 +77,7 @@ data Event =
77 | EndPointClosed
77 | EndPointClosed
78 -- | An error occurred
78 -- | An error occurred
79 | ErrorEvent (TransportError EventErrorCode)
79 | ErrorEvent (TransportError EventErrorCode)
80− deriving Show
80+ deriving (Show, Eq)
82-- | Connection data ConnectHintsIDs enable receivers to distinguish one connection from another.
82-- | Connection data ConnectHintsIDs enable receivers to distinguish one connection from another.
83type ConnectionId = Int
83type ConnectionId = Int
@@ -87,7 +87,7 @@ data Reliability =
87 ReliableOrdered
87 ReliableOrdered
88 | ReliableUnordered
88 | ReliableUnordered
89 | Unreliable
89 | Unreliable
90− deriving Show
90+ deriving (Show, Eq)
92-- | Multicast group.
92-- | Multicast group.
93data MulticastGroup = MulticastGroup {
93data MulticastGroup = MulticastGroup {
@@ -154,13 +154,17 @@ data TransportError error = TransportError error String
154-- exceptions.
154-- exceptions.
155instance (Typeable err, Show err) => Exception (TransportError err)
155instance (Typeable err, Show err) => Exception (TransportError err)
157+-- | When comparing errors we ignore the human-readable strings
158+instance Eq error => Eq (TransportError error) where
159+ TransportError err1 _ == TransportError err2 _ = err1 == err2
157-- | Errors during the creation of an endpoint
161-- | Errors during the creation of an endpoint
158data NewEndPointErrorCode =
162data NewEndPointErrorCode =
159 -- | Not enough resources
163 -- | Not enough resources
160 NewEndPointInsufficientResources
164 NewEndPointInsufficientResources
161 -- | Failed for some other reason
165 -- | Failed for some other reason
162 | NewEndPointFailed
166 | NewEndPointFailed
163− deriving (Show, Typeable)
167+ deriving (Show, Typeable, Eq)
165-- | Connection failure
169-- | Connection failure
166data ConnectErrorCode =
170data ConnectErrorCode =
@@ -170,7 +174,7 @@ data ConnectErrorCode =
170 | ConnectInsufficientResources
174 | ConnectInsufficientResources
171 -- | Failed for other reasons (including syntax error)
175 -- | Failed for other reasons (including syntax error)
172 | ConnectFailed
176 | ConnectFailed
173− deriving (Show, Typeable)
177+ deriving (Show, Typeable, Eq)
175-- | Failure during the creation of a new multicast group
179-- | Failure during the creation of a new multicast group
176data NewMulticastGroupErrorCode =
180data NewMulticastGroupErrorCode =
@@ -180,7 +184,7 @@ data NewMulticastGroupErrorCode =
180 | NewMulticastGroupFailed
184 | NewMulticastGroupFailed
181 -- | Not all transport implementations support multicast
185 -- | Not all transport implementations support multicast
182 | NewMulticastGroupUnsupported
186 | NewMulticastGroupUnsupported
183− deriving (Show, Typeable)
187+ deriving (Show, Typeable, Eq)
185-- | Failure during the resolution of a multicast group
189-- | Failure during the resolution of a multicast group
186data ResolveMulticastGroupErrorCode =
190data ResolveMulticastGroupErrorCode =
@@ -190,7 +194,7 @@ data ResolveMulticastGroupErrorCode =
190 | ResolveMulticastGroupFailed
194 | ResolveMulticastGroupFailed
191 -- | Not all transport implementations support multicast
195 -- | Not all transport implementations support multicast
192 | ResolveMulticastGroupUnsupported
196 | ResolveMulticastGroupUnsupported
193− deriving (Show, Typeable)
197+ deriving (Show, Typeable, Eq)
195-- | Failure during sending a message
199-- | Failure during sending a message
196data SendErrorCode =
200data SendErrorCode =
@@ -198,7 +202,7 @@ data SendErrorCode =
198 SendClosed
202 SendClosed
199 -- | Send failed for some other reason
203 -- | Send failed for some other reason
200 | SendFailed
204 | SendFailed
201− deriving (Show, Typeable)
205+ deriving (Show, Typeable, Eq)
203-- | Error codes used when reporting errors to endpoints (through receive)
207-- | Error codes used when reporting errors to endpoints (through receive)
204data EventErrorCode =
208data EventErrorCode =
@@ -208,4 +212,4 @@ data EventErrorCode =
208 | EventTransportFailed
212 | EventTransportFailed
209 -- | Connection to a remote endpoint was lost
213 -- | Connection to a remote endpoint was lost
210 | EventConnectionLost EndPointAddress [ConnectionId]
214 | EventConnectionLost EndPointAddress [ConnectionId]
211− deriving Show
215+ deriving (Show, Typeable, Eq)