git.iko.soy/distributed-process
on master help sign in
Merge branch 'master' of git://github.com/haskell-distributed/distributed-process
7a40241Tim Watson
src/Control/Distributed/Process/Closure.hs+4
@@ -163,6 +163,8 @@ module Control.Distributed.Process.Closure
163 , sdictUnit
163 , sdictUnit
164 , sdictProcessId
164 , sdictProcessId
165 , sdictSendPort
165 , sdictSendPort
166+ , sdictStatic
167+ , sdictClosure
166 -- * The CP type and associated combinators
168 -- * The CP type and associated combinators
167 , CP
169 , CP
168 , idCP
170 , idCP
@@ -203,6 +205,8 @@ import Control.Distributed.Process.Internal.Closure.BuiltIn
203 , sdictUnit
205 , sdictUnit
204 , sdictProcessId
206 , sdictProcessId
205 , sdictSendPort
207 , sdictSendPort
208+ , sdictStatic
209+ , sdictClosure
206 -- The CP type and associated combinators
210 -- The CP type and associated combinators
207 , CP
211 , CP
208 , idCP
212 , idCP
src/Control/Distributed/Process/Internal/Closure/BuiltIn.hs+11
@@ -8,6 +8,8 @@ module Control.Distributed.Process.Internal.Closure.BuiltIn
8 , sdictUnit
8 , sdictUnit
9 , sdictProcessId
9 , sdictProcessId
10 , sdictSendPort
10 , sdictSendPort
11+ , sdictStatic
12+ , sdictClosure
11 -- * Some static values
13 -- * Some static values
12 , sndStatic
14 , sndStatic
13 -- * The CP type and associated combinators
15 -- * The CP type and associated combinators
@@ -82,6 +84,7 @@ remoteTable =
82 . registerStatic "$sdictUnit" (toDynamic (SerializableDict :: SerializableDict ()))
84 . registerStatic "$sdictUnit" (toDynamic (SerializableDict :: SerializableDict ()))
83 . registerStatic "$sdictProcessId" (toDynamic (SerializableDict :: SerializableDict ProcessId))
85 . registerStatic "$sdictProcessId" (toDynamic (SerializableDict :: SerializableDict ProcessId))
84 . registerStatic "$sdictSendPort_" (toDynamic (sdictSendPort_ :: SerializableDict ANY -> SerializableDict (SendPort ANY)))
86 . registerStatic "$sdictSendPort_" (toDynamic (sdictSendPort_ :: SerializableDict ANY -> SerializableDict (SendPort ANY)))
87+ . registerStatic "$sdictClosure" (toDynamic (SerializableDict :: SerializableDict (Closure ANY)))
85 . registerStatic "$returnProcess" (toDynamic (return :: ANY -> Process ANY))
88 . registerStatic "$returnProcess" (toDynamic (return :: ANY -> Process ANY))
86 . registerStatic "$seqProcess" (toDynamic ((>>) :: Process ANY1 -> Process ANY2 -> Process ANY2))
89 . registerStatic "$seqProcess" (toDynamic ((>>) :: Process ANY1 -> Process ANY2 -> Process ANY2))
87 . registerStatic "$bindProcess" (toDynamic ((>>=) :: Process ANY1 -> (ANY1 -> Process ANY2) -> Process ANY2))
90 . registerStatic "$bindProcess" (toDynamic ((>>=) :: Process ANY1 -> (ANY1 -> Process ANY2) -> Process ANY2))
@@ -144,6 +147,14 @@ sdictSendPort :: Typeable a
144 => Static (SerializableDict a) -> Static (SerializableDict (SendPort a))
147 => Static (SerializableDict a) -> Static (SerializableDict (SendPort a))
145sdictSendPort = staticApply (staticLabel "$sdictSendPort_")
148sdictSendPort = staticApply (staticLabel "$sdictSendPort_")
146
149
150+-- | Serialization dictionary for 'Static'.
151+sdictStatic :: Typeable a => Static (SerializableDict (Static a))
152+sdictStatic = staticLabel "$sdictStatic"
153+
154+-- | Serialization dictionary for 'Closure'.
155+sdictClosure :: Typeable a => Static (SerializableDict (Closure a))
156+sdictClosure = staticLabel "$sdictClosure"
157+
147--------------------------------------------------------------------------------
158--------------------------------------------------------------------------------
148-- Static values --
159-- Static values --
149--------------------------------------------------------------------------------
160--------------------------------------------------------------------------------
src/Control/Distributed/Process/Internal/Primitives.hs+3−5
@@ -1025,11 +1025,9 @@ say string = do
1025-- Registry --
1025-- Registry --
1026--------------------------------------------------------------------------------
1026--------------------------------------------------------------------------------
1027
1027
1028−-- | Register a process with the local registry (asynchronous).
1028+-- | Register a process with the local registry (synchronous). The name must not
1029−-- This version will wait until a response is gotten from the
1030−-- management process. The name must not already be registered.
1031−-- The process need not be on this node.
1029+-- already be registered. The process need not be on this node. A bad
1032−-- A bad registration will result in a 'ProcessRegistrationException'
1030+-- registration will result in a 'ProcessRegistrationException'
1033--
1031--
1034-- The process to be registered does not have to be local itself.
1032-- The process to be registered does not have to be local itself.
1035register :: String -> ProcessId -> Process ()
1033register :: String -> ProcessId -> Process ()
src/Control/Distributed/Process/Internal/Types.hs+4−3
@@ -86,6 +86,7 @@ module Control.Distributed.Process.Internal.Types
86import System.Mem.Weak (Weak)
86import System.Mem.Weak (Weak)
87import Data.Map (Map)
87import Data.Map (Map)
88import Data.Int (Int32)
88import Data.Int (Int32)
89+import Data.Data (Data)
89import Data.Typeable (Typeable, typeOf)
90import Data.Typeable (Typeable, typeOf)
90import Data.Binary (Binary(put, get), putWord8, getWord8, encode)
91import Data.Binary (Binary(put, get), putWord8, getWord8, encode)
91import qualified Data.ByteString as BSS (ByteString, concat, copy)
92import qualified Data.ByteString as BSS (ByteString, concat, copy)
@@ -133,7 +134,7 @@ import GHC.Generics
133
134
134-- | Node identifier
135-- | Node identifier
135newtype NodeId = NodeId { nodeAddress :: NT.EndPointAddress }
136newtype NodeId = NodeId { nodeAddress :: NT.EndPointAddress }
136− deriving (Eq, Ord, Typeable, Generic)
137+ deriving (Eq, Ord, Typeable, Data, Generic)
137instance Binary NodeId where
138instance Binary NodeId where
138instance NFData NodeId
139instance NFData NodeId
139instance Hashable NodeId where
140instance Hashable NodeId where
@@ -146,7 +147,7 @@ data LocalProcessId = LocalProcessId
146 { lpidUnique :: {-# UNPACK #-} !Int32
147 { lpidUnique :: {-# UNPACK #-} !Int32
147 , lpidCounter :: {-# UNPACK #-} !Int32
148 , lpidCounter :: {-# UNPACK #-} !Int32
148 }
149 }
149− deriving (Eq, Ord, Typeable, Generic, Show)
150+ deriving (Eq, Ord, Typeable, Data, Generic, Show)
150
151
151instance Hashable LocalProcessId where
152instance Hashable LocalProcessId where
152
153
@@ -157,7 +158,7 @@ data ProcessId = ProcessId
157 -- | Node-local identifier for the process
158 -- | Node-local identifier for the process
158 , processLocalId :: {-# UNPACK #-} !LocalProcessId
159 , processLocalId :: {-# UNPACK #-} !LocalProcessId
159 }
160 }
160− deriving (Eq, Ord, Typeable, Generic)
161+ deriving (Eq, Ord, Typeable, Data, Generic)
161
162
162instance Binary ProcessId where
163instance Binary ProcessId where
163instance NFData ProcessId where
164instance NFData ProcessId where