From 747a097856a0f5215b42f1363fa2c6344f9a82fa Mon Sep 17 00:00:00 2001 From: Abhiroop Sarkar Date: Sat, 24 Jun 2017 16:58:03 +0530 Subject: [PATCH 1/3] Make the code typecheck --- tutorials/3ch.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tutorials/3ch.md b/tutorials/3ch.md index dd77e67..2aa3bad 100644 --- a/tutorials/3ch.md +++ b/tutorials/3ch.md @@ -285,10 +285,11 @@ of exit reasons. {% highlight haskell %} demo = do - pid <- spawnLocal $ receive >>= return + pid <- spawnLocal $ expect >>= return link pid send pid () - () <- receive + () <- expect + return () {% endhighlight %} The medium that link failures uses to signal exit conditions is the same as exit and kill From de4350fec376376f23790fa85a5a2a11d214a204 Mon Sep 17 00:00:00 2001 From: Abhiroop Sarkar Date: Sun, 25 Jun 2017 13:25:49 +0530 Subject: [PATCH 2/3] Change start to serve and show the necessary imports from other packages --- tutorials/4ch.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tutorials/4ch.md b/tutorials/4ch.md index 2475784..93a37a5 100644 --- a/tutorials/4ch.md +++ b/tutorials/4ch.md @@ -120,6 +120,8 @@ module MathServer , launchMathServer ) where +import Control.Distributed.Process.ManagedProcess +import Control.Distributed.Process.Extras.Time import .... -- elided -- We keep this data-type hidden from the outside world, and we ignore @@ -148,7 +150,7 @@ launchMathServer = apiHandlers = [ handleCall_ (\(Add x y) -> return (x + y)) ] , unhandledMessagePolicy = Drop } - in spawnLocal $ start () (statelessInit Infinity) server >> return () + in spawnLocal $ serve () (statelessInit Infinity) server >> return () {% endhighlight %} @@ -191,7 +193,7 @@ launchMathServer = apiHandlers = [ handleRpcChan_ (\chan (Add x y) -> sendChan chan (x + y)) ] , unhandledMessagePolicy = Drop } - in spawnLocal $ start () (statelessInit Infinity) server >> return () + in spawnLocal $ serve () (statelessInit Infinity) server >> return () {% endhighlight %} Ensuring that only valid types are sent to the server is relatively simple, @@ -230,7 +232,7 @@ launchMathServer = , handleCast_ (\(Add x y) -> liftIO $ putStrLn $ show (x + y) >> continue_) ] , unhandledMessagePolicy = Drop } - in spawnLocal $ start () (statelessInit Infinity) server >> return () + in spawnLocal $ serve () (statelessInit Infinity) server >> return () {% endhighlight %} From ca5226eb297cecfd7b6dd4303cb6dfa5258714e6 Mon Sep 17 00:00:00 2001 From: Abhiroop Sarkar Date: Sun, 25 Jun 2017 13:28:11 +0530 Subject: [PATCH 3/3] add the package name in comments --- tutorials/4ch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/4ch.md b/tutorials/4ch.md index 93a37a5..e89cc21 100644 --- a/tutorials/4ch.md +++ b/tutorials/4ch.md @@ -120,8 +120,8 @@ module MathServer , launchMathServer ) where -import Control.Distributed.Process.ManagedProcess -import Control.Distributed.Process.Extras.Time +import Control.Distributed.Process.ManagedProcess -- from the package `distributed-process-client-server` +import Control.Distributed.Process.Extras.Time -- from the package `distributed-process-extras` import .... -- elided -- We keep this data-type hidden from the outside world, and we ignore