@@ -29,7 +29,6 @@ module Control.Distributed.Process.Internal.Closure.CP
2929import Data.Binary (encode)
3030import Data.ByteString.Lazy (ByteString)
3131import Data.Typeable (Typeable, typeOf, typeRepTyCon, TyCon)
32−import Data.Typeable.Internal (TypeRep(..))
3332import Control.Applicative ((<$>))
3433import Control.Monad ((>=>))
3534import Control.Distributed.Process.Serializable (Serializable)
@@ -77,6 +76,7 @@ import Control.Distributed.Process.Internal.Dynamic
7776 , dynTypeRep
7877 , dynKleisli
7978 )
79+import Control.Distributed.Process.Internal.TypeRep (compareTypeRep)
8080
8181--------------------------------------------------------------------------------
8282-- Setup: A number of functions that we will pass to 'remotable' --
@@ -123,18 +123,12 @@ unClosure (Static label) env = do
123123 Nothing -> fail "Derived.unClosure: resolveClosure failed"
124124 Just dyn -> return dyn
125125
126−-- | Work around a bug in Typeable
127−-- (http://hackage.haskell.org/trac/ghc/ticket/5692)
128−compareWithoutFingerprint :: TypeRep -> TypeRep -> Bool
129−compareWithoutFingerprint (TypeRep _ con ts) (TypeRep _ con' ts')
130− = con == con' && all (uncurry compareWithoutFingerprint) (zip ts ts')
131−
132126-- | Remove a 'Dynamic' constructor, provided that the recorded type matches the
133127-- type of the first static argument (the value of that argument is not used)
134128unDynamic :: Static a -> Process Dynamic -> Process a
135129unDynamic (Static label) pdyn = do
136130 Dynamic typ val <- pdyn
137− if compareWithoutFingerprint typ (typeOfStaticLabel label) -- typ == typeOfStaticLabel label
131+ if typ `compareTypeRep` typeOfStaticLabel label
138132 then return (unsafeCoerce# val)
139133 else fail $ "unDynamic: cannot match "
140134 ++ show typ