@@ -138,6 +138,9 @@ main = do
138138 -- Die immediately - throws a ProcessExitException with the given reason.
139139 Nothing -> die "nothing came back!"
140140 Just s -> say $ "got " ++ s ++ " back!"
141+
142+ -- Without the following delay, the process sometimes exits before the messages are exchanged.
143+ liftIO $ threadDelay 2000000
141144{% endhighlight %}
142145
143146Note that we've used ` receiveWait ` this time around to get a message.
@@ -198,7 +201,7 @@ not depend on any runtime arguments). The type of static actions in Cloud
198201Haskell is ` Closure (Process a) ` . More generally, a value of type ` Closure b `
199202is a value that was constructed explicitly as the composition of symbolic
200203pointers and serializable values. Values of type ` Closure b ` are serializable,
201- even if values of type ` b ` might not. For instance, while we can't in general
204+ even if values of type ` b ` might not be . For instance, while we can't in general
202205send actions of type ` Process () ` , we can construct a value of type `Closure
203206(Process ())` instead, containing a symbolic name for the action, and send
204207that instead. So long as the remote end understands the same meaning for the
@@ -218,7 +221,7 @@ For curried functions, you'll need to uncurry them first (i.e. "tuple up" the
218221arguments). However, to ensure that the remote side can adequately interpret
219222the resulting ` Closure ` , you'll need to add a mapping in a so-called * remote
220223table* associating the symbolic name of a function to its value. Processes can
221- only be successfully spawned on remote nodes of all these remote nodes have
224+ only be successfully spawned on remote nodes if all these remote nodes have
222225the same remote table as the local one.
223226
224227We need to configure our remote table (see the [ API reference] [ 6 ] for
@@ -278,8 +281,8 @@ In the above example, we spawn `sampleTask` on node `us` in two
278281different ways:
279282
280283* using ` spawn ` , which expects some node identifier to spawn a process
281- on along for the action of the process.
282- * using ` spawnLocal ` , a specialization of ` spawn ` to the case when the
284+ on along with a ` Closure ` for the action of the process.
285+ * using ` spawnLocal ` , a specialization of ` spawn ` for the case when the
283286 node identifier actually refers to the local node (i.e. ` us ` ). In
284287 this special case, no serialization is necessary, so passing an
285288 action directly rather than a ` Closure ` works just fine.
0 commit comments