@@ -120,6 +120,8 @@ module MathServer
120
120
, launchMathServer
121
121
) where
122
122
123
+ import Control.Distributed.Process.ManagedProcess
124
+ import Control.Distributed.Process.Extras.Time
123
125
import .... -- elided
124
126
125
127
-- We keep this data-type hidden from the outside world, and we ignore
@@ -148,7 +150,7 @@ launchMathServer =
148
150
apiHandlers = [ handleCall_ (\( Add x y) -> return (x + y)) ]
149
151
, unhandledMessagePolicy = Drop
150
152
}
151
- in spawnLocal $ start () (statelessInit Infinity) server >> return ()
153
+ in spawnLocal $ serve () (statelessInit Infinity) server >> return ()
152
154
{% endhighlight %}
153
155
154
156
@@ -191,7 +193,7 @@ launchMathServer =
191
193
apiHandlers = [ handleRpcChan_ (\chan (Add x y) -> sendChan chan (x + y)) ]
192
194
, unhandledMessagePolicy = Drop
193
195
}
194
- in spawnLocal $ start () (statelessInit Infinity) server >> return ()
196
+ in spawnLocal $ serve () (statelessInit Infinity) server >> return ()
195
197
{% endhighlight %}
196
198
197
199
Ensuring that only valid types are sent to the server is relatively simple,
@@ -230,7 +232,7 @@ launchMathServer =
230
232
, handleCast_ (\( Add x y) -> liftIO $ putStrLn $ show (x + y) >> continue_ ) ]
231
233
, unhandledMessagePolicy = Drop
232
234
}
233
- in spawnLocal $ start () (statelessInit Infinity) server >> return ()
235
+ in spawnLocal $ serve () (statelessInit Infinity) server >> return ()
234
236
{% endhighlight %}
235
237
236
238
0 commit comments