Skip to content

Make the code typecheck #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tutorials/3ch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions tutorials/4ch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 %}


Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 %}


Expand Down