haskell-distributed / distributed-process-platform

DEPRECATED (Cloud Haskell Platform) in favor of distributed-process-extras, distributed-process-async, distributed-process-client-server, distributed-process-registry, distributed-process-supervisor, distributed-process-task and distributed-process-execution
http://haskell-distributed.github.com
BSD 3-Clause "New" or "Revised" License
47 stars 17 forks source link

[DPP-57] Provide versions of handle{Cast|Call}_ that work in the Process monad #123

Open qnikst opened 9 years ago

qnikst commented 9 years ago

[Imported from JIRA. Reported by Tim Watson [Administrator] @hyperthunk) as DPP-57 on 2013-01-14 22:12:01] Consider these two cast handlers:

handleCastIf_ (\(c :: String, _ :: Delay) -> c == "timeout")
                            (\("timeout", Delay d) -> timeoutAfter_ d),
handleCast    (\s' ("ping", pid :: ProcessId) ->
                                 send pid "pong" >> continue s')

There's no great reason why we shouldn't be able to skip the state in the latter as we do with the former, but the continue_ function returns (s -> Process (ProcessAction s)) which means it can't be used in monadic code like this.