Skip to content

Commit 606e8f3

Browse files
Merge pull request #26 from vertexcite/minor-tutorial-fixes-201608a
Minor tutorial fixes 201608a Thanks @vertexcite.
2 parents fdbd08e + 5557618 commit 606e8f3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tutorials/1ch.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

143146
Note 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
198201
Haskell is `Closure (Process a)`. More generally, a value of type `Closure b`
199202
is a value that was constructed explicitly as the composition of symbolic
200203
pointers 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
202205
send actions of type `Process ()`, we can construct a value of type `Closure
203206
(Process ())` instead, containing a symbolic name for the action, and send
204207
that 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
218221
arguments). However, to ensure that the remote side can adequately interpret
219222
the resulting `Closure`, you'll need to add a mapping in a so-called *remote
220223
table* 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
222225
the same remote table as the local one.
223226

224227
We 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
278281
different 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

Comments
 (0)