network-transport 0.4.2.0 → 0.4.3.0
raw patch · 3 files changed
+28/−23 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- ChangeLog +6/−0
- network-transport.cabal +5/−5
- src/Network/Transport.hs +17/−18
ChangeLog view
@@ -1,3 +1,9 @@+2016-01-28 Facundo Domínguez <facundo.dominguez@tweag.io> 0.4.3.0++* Derive Binary instances for missing types.+* Use auto-derive for Reliability as Binary instance.+* Stop testing with ghc-7.4 and build with ghc-7.10.+ 2015-06-15 Facundo Domínguez <facundo.dominguez@tweag.io> 0.4.2.0 * Add NFData instance for EndPointAddress.
network-transport.cabal view
@@ -1,12 +1,12 @@ Name: network-transport-Version: 0.4.2.0+Version: 0.4.3.0 Cabal-Version: >=1.6 Build-Type: Simple License: BSD3 License-File: LICENSE Copyright: Well-Typed LLP Author: Duncan Coutts, Nicolas Wu, Edsko de Vries-Maintainer: Facundo Domínguez <facundo.dominguez@tweag.io>+Maintainer: edsko@well-typed.com, duncan@well-typed.com, watson.timothy@gmail.com Stability: experimental Homepage: http://haskell-distributed.github.com Bug-Reports: https://cloud-haskell.atlassian.net/browse/NT@@ -35,12 +35,12 @@ . * In addition to incoming messages, 'EndPoint's are notified of other 'Event's such as new connections or broken connections.- .+ . This design was heavily influenced by the design of the Common Communication Interface (<http://www.olcf.ornl.gov/center-projects/common-communication-interface>). Important design goals are:- .+ . * Connections should be lightweight: it should be no problem to create thousands of connections between endpoints. .@@ -55,7 +55,7 @@ This package provides the generic interface only; you will probably also want to install at least one transport implementation (network-transport-*).-Tested-With: GHC==7.4.2 GHC==7.6.3 GHC==7.8.4 GHC==7.10.1+Tested-With: GHC==7.0.4 GHC==7.2.2 GHC==7.4.1 GHC==7.4.2 Category: Network extra-source-files: ChangeLog
src/Network/Transport.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DeriveGeneric #-} -- | Network Transport module Network.Transport ( -- * Types@@ -30,10 +31,11 @@ import Control.Exception (Exception) import Control.Applicative ((<$>)) import Data.Typeable (Typeable)-import Data.Binary (Binary(put, get), putWord8, getWord8)+import Data.Binary (Binary(..)) import Data.Hashable import Data.Word (Word64) import Data.Data (Data)+import GHC.Generics (Generic) -------------------------------------------------------------------------------- -- Main API --@@ -98,8 +100,10 @@ | EndPointClosed -- | An error occurred | ErrorEvent (TransportError EventErrorCode)- deriving (Show, Eq)+ deriving (Show, Eq, Generic) +instance Binary Event+ -- | Connection data ConnectHintsIDs enable receivers to distinguish one connection from another. type ConnectionId = Word64 @@ -108,20 +112,9 @@ ReliableOrdered | ReliableUnordered | Unreliable- deriving (Show, Eq, Typeable)--instance Binary Reliability where- put ReliableOrdered = putWord8 0- put ReliableUnordered = putWord8 1- put Unreliable = putWord8 2- get = do- header <- getWord8- case header of- 0 -> return ReliableOrdered- 1 -> return ReliableUnordered- 2 -> return Unreliable- _ -> fail "Reliability.get: invalid"+ deriving (Show, Eq, Typeable, Generic) +instance Binary Reliability -- | Multicast group. data MulticastGroup = MulticastGroup { -- | EndPointAddress of the multicast group.@@ -155,8 +148,10 @@ -- | EndPointAddress of a multicast group. newtype MulticastAddress = MulticastAddress { multicastAddressToByteString :: ByteString }- deriving (Eq, Ord)+ deriving (Eq, Ord, Generic) +instance Binary MulticastAddress+ instance Show MulticastAddress where show = show . multicastAddressToByteString @@ -191,8 +186,10 @@ -- | Errors returned by Network.Transport API functions consist of an error -- code and a human readable description of the problem data TransportError error = TransportError error String- deriving (Show, Typeable)+ deriving (Show, Typeable, Generic) +instance (Binary error) => Binary (TransportError error)+ -- | Although the functions in the transport API never throw TransportErrors -- (but return them explicitly), application code may want to turn these into -- exceptions.@@ -287,4 +284,6 @@ -- or for the EventConnectionLost to be posted and for the new connection -- to be considered the first connection of the "new bundle". | EventConnectionLost EndPointAddress- deriving (Show, Typeable, Eq)+ deriving (Show, Typeable, Eq, Generic)++instance Binary EventErrorCode