@@ -294,14 +294,14 @@ spawn nid proc = do
294294 `seqCP` proc
295295 mPid <- receiveWait
296296 [ matchIf (\(DidSpawn ref _) -> ref == sRef)
297− (\(DidSpawn _ pid) -> return $ Just pid)
297+ (\(DidSpawn _ pid) -> return $ Right pid)
298298 , matchIf (\(NodeMonitorNotification ref _ _) -> ref == mRef)
299− (\_ -> return Nothing)
299+ (\(NodeMonitorNotification _ _ err) -> return $ Left err)
300300 ]
301301 unmonitor mRef
302302 case mPid of
303− Nothing -> fail "spawn: remote node failed"
304− Just pid -> send pid () >> return pid
303+ Left err -> fail $ "spawn: remote node failed: " ++ show err
304+ Right pid -> send pid () >> return pid
305305
306306-- | Spawn a process and link to it
307307--