git.iko.soy/distributed-process
on master help sign in
Merge pull request #168 from tweag/closure-closure

Adding missing remote table entry for sdictStatic.

commit8ec85d011377bbe540433298668cb554dff5940b authorTim Watson <watson.timothy@gmail.com> dateWed 17 Dec 2014, 21:25 (12 years ago) parent79a9234b47011b
2 files changed+19−5
src/Control/Distributed/Process/Internal/Closure/BuiltIn.hs+13−5 src/Control/Distributed/Process/Serializable.hs+6
src/Control/Distributed/Process/Internal/Closure/BuiltIn.hs+13−5
@@ -52,6 +52,7 @@ import Control.Distributed.Static
5252import Control.Distributed.Process.Serializable
5353 ( SerializableDict(..)
5454 , Serializable
55+ , TypeableDict(..)
5556 )
5657import Control.Distributed.Process.Internal.Types
5758 ( Process
@@ -84,7 +85,8 @@ remoteTable =
8485 . registerStatic "$sdictUnit" (toDynamic (SerializableDict :: SerializableDict ()))
8586 . registerStatic "$sdictProcessId" (toDynamic (SerializableDict :: SerializableDict ProcessId))
8687 . registerStatic "$sdictSendPort_" (toDynamic (sdictSendPort_ :: SerializableDict ANY -> SerializableDict (SendPort ANY)))
87− . registerStatic "$sdictClosure" (toDynamic (SerializableDict :: SerializableDict (Closure ANY)))
88+ . registerStatic "$sdictStatic" (toDynamic (sdictStatic_ :: TypeableDict ANY -> SerializableDict (Static ANY)))
89+ . registerStatic "$sdictClosure" (toDynamic (sdictClosure_ :: TypeableDict ANY -> SerializableDict (Closure ANY)))
8890 . registerStatic "$returnProcess" (toDynamic (return :: ANY -> Process ANY))
8991 . registerStatic "$seqProcess" (toDynamic ((>>) :: Process ANY1 -> Process ANY2 -> Process ANY2))
9092 . registerStatic "$bindProcess" (toDynamic ((>>=) :: Process ANY1 -> (ANY1 -> Process ANY2) -> Process ANY2))
@@ -105,6 +107,12 @@ remoteTable =
105107 sdictSendPort_ :: forall a. SerializableDict a -> SerializableDict (SendPort a)
106108 sdictSendPort_ SerializableDict = SerializableDict
107109
110+ sdictStatic_ :: forall a. TypeableDict a -> SerializableDict (Static a)
111+ sdictStatic_ TypeableDict = SerializableDict
112+
113+ sdictClosure_ :: forall a. TypeableDict a -> SerializableDict (Closure a)
114+ sdictClosure_ TypeableDict = SerializableDict
115+
108116 sendDict :: forall a. SerializableDict a -> ProcessId -> a -> Process ()
109117 sendDict SerializableDict = send
110118
@@ -148,12 +156,12 @@ sdictSendPort :: Typeable a
148156sdictSendPort = staticApply (staticLabel "$sdictSendPort_")
149157
150158-- | Serialization dictionary for 'Static'.
151−sdictStatic :: Typeable a => Static (SerializableDict (Static a))
152−sdictStatic = staticLabel "$sdictStatic"
159+sdictStatic :: Typeable a => Static (TypeableDict a) -> Static (SerializableDict (Static a))
160+sdictStatic = staticApply (staticLabel "$sdictStatic")
153161
154162-- | Serialization dictionary for 'Closure'.
155−sdictClosure :: Typeable a => Static (SerializableDict (Closure a))
156−sdictClosure = staticLabel "$sdictClosure"
163+sdictClosure :: Typeable a => Static (TypeableDict a) -> Static (SerializableDict (Closure a))
164+sdictClosure = staticApply (staticLabel "$sdictClosure")
157165
158166--------------------------------------------------------------------------------
159167-- Static values --
src/Control/Distributed/Process/Serializable.hs+6
@@ -12,6 +12,7 @@ module Control.Distributed.Process.Serializable
1212 , Fingerprint
1313 , showFingerprint
1414 , SerializableDict(SerializableDict)
15+ , TypeableDict(TypeableDict)
1516 ) where
1617
1718import Data.Binary (Binary)
@@ -41,6 +42,11 @@ data SerializableDict a where
4142 SerializableDict :: Serializable a => SerializableDict a
4243 deriving (Typeable)
4344
45+-- | Reification of 'Typeable'.
46+data TypeableDict a where
47+ TypeableDict :: Typeable a => TypeableDict a
48+ deriving (Typeable)
49+
4450-- | Objects that can be sent across the network
4551class (Binary a, Typeable a) => Serializable a
4652instance (Binary a, Typeable a) => Serializable a