git.iko.soy/distributed-process
on master help sign in
Cleanup
commit2a852cd05bcafa4a40799cbcf257e16dee64ef73 authorEdsko de Vries <edsko@edsko.net> dateFri 29 Jun 2012, 09:46 (14 years ago) parentefb4614
2 files changed+4−8
distributed-process/src/Control/Distributed/Process.hs+3−3 distributed-process/src/Control/Distributed/Process/Node.hs+1−5
distributed-process/src/Control/Distributed/Process.hs+3−3
@@ -216,10 +216,10 @@ spawnSupervised nid proc = do
216216unClosure :: forall a. Typeable a => Closure a -> Process a
217217unClosure (Closure (Static label) env) = do
218218 rtable <- remoteTable <$> procMsg getLocalNode
219− let Just dyn = resolveClosure rtable label env
220− return $ fromDyn dyn (throw (typeError dyn))
219+ case resolveClosure rtable label env of
220+ Nothing -> throw . userError $ "Unregistered closure " ++ show label
221+ Just dyn -> return $ fromDyn dyn (throw (typeError dyn))
221222 where
222223 typeError dyn = userError $ "lookupStatic type error: "
223224 ++ "cannot match " ++ show (dynTypeRep dyn)
224225 ++ " against " ++ show (typeOf (undefined :: a))
225−
distributed-process/src/Control/Distributed/Process/Node.hs+1−5
@@ -490,14 +490,10 @@ isLocal :: LocalNode -> ProcessId -> Bool
490490isLocal nid pid = processNodeId pid == localNodeId nid
491491
492492-- | Lookup a local closure
493−--
494−-- TODO: Duplication with onClosure in Process
495493unClosure :: Typeable a => Closure a -> NC (Maybe a)
496494unClosure (Closure (Static label) env) = do
497495 rtable <- remoteTable <$> ncMsg getLocalNode
498− case resolveClosure rtable label env of
499− Nothing -> return Nothing
500− Just dyn -> return (fromDynamic dyn)
496+ return (resolveClosure rtable label env >>= fromDynamic)
501497
502498--------------------------------------------------------------------------------
503499-- Messages to local processes --