From 4ccd1c508da22ef1ca21cd2b7e5f0fa0741607ad Mon Sep 17 00:00:00 2001 From: Randall Britten Date: Sun, 21 Aug 2016 14:52:03 +1200 Subject: [PATCH 1/4] Minor grammar fixes --- tutorials/1ch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/1ch.md b/tutorials/1ch.md index dd16538..82fe7ba 100644 --- a/tutorials/1ch.md +++ b/tutorials/1ch.md @@ -198,7 +198,7 @@ not depend on any runtime arguments). The type of static actions in Cloud Haskell is `Closure (Process a)`. More generally, a value of type `Closure b` is a value that was constructed explicitly as the composition of symbolic pointers and serializable values. Values of type `Closure b` are serializable, -even if values of type `b` might not. For instance, while we can't in general +even if values of type `b` might not be. For instance, while we can't in general send actions of type `Process ()`, we can construct a value of type `Closure (Process ())` instead, containing a symbolic name for the action, and send that instead. So long as the remote end understands the same meaning for the @@ -218,7 +218,7 @@ For curried functions, you'll need to uncurry them first (i.e. "tuple up" the arguments). However, to ensure that the remote side can adequately interpret the resulting `Closure`, you'll need to add a mapping in a so-called *remote table* associating the symbolic name of a function to its value. Processes can -only be successfully spawned on remote nodes of all these remote nodes have +only be successfully spawned on remote nodes if all these remote nodes have the same remote table as the local one. We need to configure our remote table (see the [API reference][6] for From 17bf571b26ccf7ddaa208225fd9b547afc2d541c Mon Sep 17 00:00:00 2001 From: Randall Britten Date: Sun, 21 Aug 2016 15:11:57 +1200 Subject: [PATCH 2/4] Add a delay to second example --- tutorials/1ch.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tutorials/1ch.md b/tutorials/1ch.md index 82fe7ba..a17195f 100644 --- a/tutorials/1ch.md +++ b/tutorials/1ch.md @@ -138,6 +138,9 @@ main = do -- Die immediately - throws a ProcessExitException with the given reason. Nothing -> die "nothing came back!" Just s -> say $ "got " ++ s ++ " back!" + + -- Without the following delay, the process sometimes exits before the messages are exchanged. + liftIO $ threadDelay 2000000 {% endhighlight %} Note that we've used `receiveWait` this time around to get a message. From 753d7449d6d27f29c045c86b8aa739ea2d6b9db5 Mon Sep 17 00:00:00 2001 From: Randall Britten Date: Sun, 21 Aug 2016 15:18:19 +1200 Subject: [PATCH 3/4] Fixed sentence to make sense --- tutorials/1ch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/1ch.md b/tutorials/1ch.md index a17195f..fc553b0 100644 --- a/tutorials/1ch.md +++ b/tutorials/1ch.md @@ -281,8 +281,8 @@ In the above example, we spawn `sampleTask` on node `us` in two different ways: * using `spawn`, which expects some node identifier to spawn a process - on along for the action of the process. * using `spawnLocal`, a specialization of `spawn` to the case when the + on along with a `Closure` for the action of the process. node identifier actually refers to the local node (i.e. `us`). In this special case, no serialization is necessary, so passing an action directly rather than a `Closure` works just fine. From 55576188c1fc1da6e3fd041bb2bea4bd876bde2d Mon Sep 17 00:00:00 2001 From: Randall Britten Date: Sun, 21 Aug 2016 15:19:23 +1200 Subject: [PATCH 4/4] Minor grammar fix --- tutorials/1ch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/1ch.md b/tutorials/1ch.md index fc553b0..41f00e1 100644 --- a/tutorials/1ch.md +++ b/tutorials/1ch.md @@ -281,8 +281,8 @@ In the above example, we spawn `sampleTask` on node `us` in two different ways: * using `spawn`, which expects some node identifier to spawn a process -* using `spawnLocal`, a specialization of `spawn` to the case when the on along with a `Closure` for the action of the process. +* using `spawnLocal`, a specialization of `spawn` for the case when the node identifier actually refers to the local node (i.e. `us`). In this special case, no serialization is necessary, so passing an action directly rather than a `Closure` works just fine.