git.iko.soy/distributed-process
on master help sign in
Improve pretty-printing of identifiers
commit964c186f69320ea1b42dba7df699a070cf077978 authorEdsko de Vries <edsko@edsko.net> dateThu 5 Jul 2012, 16:49 (14 years ago) parentabcaed4
1 file changed+5−3
distributed-process/src/Control/Distributed/Process/Internal/Types.hs+5−3
distributed-process/src/Control/Distributed/Process/Internal/Types.hs+5−3
@@ -119,7 +119,7 @@ newtype NodeId = NodeId { nodeAddress :: NT.EndPointAddress }
119119 deriving (Eq, Ord, Binary)
120120
121121instance Show NodeId where
122− show = show . nodeAddress
122+ show (NodeId addr) = "nid://" ++ show addr
123123
124124-- | A local process ID consists of a seed which distinguishes processes from
125125-- different instances of the same local node and a counter
@@ -140,7 +140,8 @@ data ProcessId = ProcessId
140140 deriving (Eq, Ord, Typeable)
141141
142142instance Show ProcessId where
143− show pid = show (processNodeId pid) ++ ":" ++ show (processLocalId pid)
143+ show (ProcessId (NodeId addr) (LocalProcessId _ lid))
144+ = "pid://" ++ show addr ++ ":" ++ show lid
144145
145146-- | Union of all kinds of identifiers
146147data Identifier =
@@ -223,7 +224,8 @@ data SendPortId = SendPortId {
223224 deriving (Eq, Ord)
224225
225226instance Show SendPortId where
226− show cid = show (sendPortProcessId cid) ++ ":" ++ show (sendPortLocalId cid)
227+ show (SendPortId (ProcessId (NodeId addr) (LocalProcessId _ plid)) clid)
228+ = "cid://" ++ show addr ++ ":" ++ show plid ++ ":" ++ show clid
227229
228230data TypedChannel = forall a. Serializable a => TypedChannel (TChan a)
229231