@@ -149,6 +149,7 @@ module Control.Distributed.Process
149 -- * Local versions of 'spawn'
149 -- * Local versions of 'spawn'
150 , spawnLocal
150 , spawnLocal
151 , spawnChannelLocal
151 , spawnChannelLocal
152 -- * Reconnecting
153 -- * Reconnecting
153 , reconnect
154 , reconnect
154 , reconnectPort
155 , reconnectPort
@@ -302,6 +303,7 @@ import Control.Distributed.Process.Internal.Spawn
302 , spawnSupervised
303 , spawnSupervised
306+import Control.Exception (SomeException, throwIO)
306-- INTERNAL NOTES
308-- INTERNAL NOTES
@@ -392,3 +394,20 @@ spawnChannelLocal proc = do
392 liftIO $ putMVar mvar sport
394 liftIO $ putMVar mvar sport
393 proc rport
395 proc rport
394 takeMVar mvar
396 takeMVar mvar
398+-- | Local version of 'call'. Running a process in this way isolates it from
399+-- messages sent to the caller process, and also allows silently dropping late
400+-- or duplicate messages sent to the isolated process after it exits.
401+-- Silently dropping messages may not always be the best approach.
403+ Process a -- ^ Process to run
404+ -> Process a -- ^ Value returned
406+ mv <- liftIO newEmptyMVar
408+ _ <- spawnLocal $ do
410+ try proc >>= liftIO . putMVar mv
411+ liftIO $ takeMVar mv >>=
412+ either (throwIO :: SomeException -> IO a) return