@@ -64,9 +64,10 @@ module Control.Distributed.Process.Internal.Types
6464import Data.Map (Map)
6565import Data.Int (Int32)
6666import Data.Typeable (Typeable)
67−import Data.Binary (Binary(put, get), putWord8, getWord8, encode)
68−import qualified Data.ByteString as BSS (ByteString, concat)
69−import qualified Data.ByteString.Lazy as BSL
67+import Data.Binary (Binary(put, get), putWord8, getWord8)
68+import Data.NotByteString.Lazy.Binary (encode)
69+import qualified Data.NotByteString as BSS (ByteString, concat)
70+import qualified Data.NotByteString.Lazy as BSL
7071 ( ByteString
7172 , toChunks
7273 , splitAt
@@ -104,12 +105,8 @@ import Control.Distributed.Static (RemoteTable, Closure)
104105--------------------------------------------------------------------------------
105106
106107-- | Node identifier
107−data NodeId = NodeId { nodeAddress :: !(NT.EndPointAddress) }
108− deriving (Eq, Ord)
109−
110−instance Binary NodeId where
111− put (NodeId nid) = put nid
112− get = NodeId <$> get
108+newtype NodeId = NodeId { nodeAddress :: NT.EndPointAddress }
109+ deriving (Eq, Ord, Binary)
113110
114111instance Show NodeId where
115112 show (NodeId addr) = "nid://" ++ show addr
@@ -117,8 +114,8 @@ instance Show NodeId where
117114-- | A local process ID consists of a seed which distinguishes processes from
118115-- different instances of the same local node and a counter
119116data LocalProcessId = LocalProcessId
120− { lpidUnique :: !Int32
121− , lpidCounter :: !Int32
117+ { lpidUnique :: {-# UNPACK #-} !Int32
118+ , lpidCounter :: {-# UNPACK #-} !Int32
122119 }
123120 deriving (Eq, Ord, Typeable, Show)
124121
@@ -127,7 +124,7 @@ data ProcessId = ProcessId
127124 { -- | The ID of the node the process is running on
128125 processNodeId :: !NodeId
129126 -- | Node-local identifier for the process
130− , processLocalId :: !LocalProcessId
127+ , processLocalId :: {-# UNPACK #-} !LocalProcessId
131128 }
132129 deriving (Eq, Ord, Typeable)
133130
@@ -218,9 +215,9 @@ type LocalSendPortId = Int32
218215-- to create a SendPort.
219216data SendPortId = SendPortId {
220217 -- | The ID of the process that will receive messages sent on this port
221− sendPortProcessId :: !ProcessId
218+ sendPortProcessId :: {-# UNPACK #-} !ProcessId
222219 -- | Process-local ID of the channel
223− , sendPortLocalId :: !LocalSendPortId
220+ , sendPortLocalId :: {-# UNPACK #-} !LocalSendPortId
224221 }
225222 deriving (Eq, Ord)
226223
@@ -388,6 +385,7 @@ data ProcessSignal =
388385 | WhereIs String
389386 | Register String (Maybe ProcessId) -- Nothing to unregister
390387 | NamedSend String Message
388+ | Reconnect Identifier
391389 deriving Show
392390
393391--------------------------------------------------------------------------------
@@ -432,6 +430,7 @@ instance Binary ProcessSignal where
432430 put (WhereIs label) = putWord8 6 >> put label
433431 put (Register label pid) = putWord8 7 >> put label >> put pid
434432 put (NamedSend label msg) = putWord8 8 >> put label >> put (messageToPayload msg)
433+ put (Reconnect dest) = putWord8 9 >> put dest
435434 get = do
436435 header <- getWord8
437436 case header of
@@ -444,6 +443,7 @@ instance Binary ProcessSignal where
444443 6 -> WhereIs <$> get
445444 7 -> Register <$> get <*> get
446445 8 -> NamedSend <$> get <*> (payloadToMessage <$> get)
446+ 9 -> Reconnect <$> get
447447 _ -> fail "ProcessSignal.get: invalid"
448448
449449instance Binary DiedReason where