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 diff --git a/tutorials/4ch.md b/tutorials/4ch.md index 2475784..e89cc21 100644 --- a/tutorials/4ch.md +++ b/tutorials/4ch.md @@ -120,6 +120,8 @@ module MathServer , launchMathServer ) where +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 @@ -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 %}