Handling failure

In a distributed system, it's customary to fail fast and let other processes deal with failure. This principle is encouraged in Erlang, from which Cloud Haskell is modelled. We should be prepared for an arbitrary process crashing, with its parent or monitoring process handling the failure (or propagating it further to a parent's parent).

There are two tactics to be noted about process failure in Cloud Haskell: linking and monitoring. The difference is that a linked process propagates exceptions to its parent, while an exception in a monitored process results in the monitoring process receiving a ProcessMonitorNotification message.

Firing up monitors

The basic monitoring API is the following:

monitor :: ProcessId → Process MonitorRef ...

Get Haskell High Performance Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.