distributed-process-extras- Cloud Haskell Extras

Safe HaskellNone




Types used throughout the Extras package



type Tag = Int Source

Tags provide uniqueness for messages, so that they can be matched with their response.

type TagPool = MVar Tag Source

Generates unique Tag for messages and response pairs. Each process that depends, directly or indirectly, on the call mechanisms in Control.Distributed.Process.Global.Call should have at most one TagPool on which to draw unique message tags.

newTagPool :: Process TagPool Source

Create a new per-process source of unique message identifiers.

getTag :: TagPool -> Process Tag Source

Extract a new identifier from a TagPool.


class Linkable a where Source

Class of things to which a Process can link itself.


linkTo :: a -> Process () Source

Create a link with the supplied object.

class Killable a where Source

Class of things that can be killed (or instructed to exit).


killProc :: a -> String -> Process () Source

exitProc :: Serializable m => a -> m -> Process () Source

class Resolvable a where Source

Class of things that can be resolved to a ProcessId.


resolve :: a -> Process (Maybe ProcessId) Source

Resolve the reference to a process id, or Nothing if resolution fails

class Routable a where Source

Provides a unified API for addressing processes.

Minimal complete definition

sendTo, unsafeSendTo


sendTo :: Serializable m => a -> m -> Process () Source

Send a message to the target asynchronously

unsafeSendTo :: NFSerializable m => a -> m -> Process () Source

Send some NFData message to the target asynchronously, forcing evaluation (i.e., deepseq) beforehand.

unresolvableMessage :: a -> String Source

Unresolvable Addressable Message

class (Resolvable a, Routable a) => Addressable a Source


data RegisterSelf Source

Used internally in whereisOrStart. Sent as (RegisterSelf,ProcessId).




whereisRemote :: NodeId -> String -> Process (Maybe ProcessId) Source

A synchronous version of whereis, this relies on call to perform the relevant monitoring of the remote node.

resolveOrDie :: (Routable a, Resolvable a) => a -> String -> Process ProcessId Source

resolve the Resolvable or die with specified msg plus details of what didn't resolve

type Channel a = (SendPort a, ReceivePort a) Source

Simple representation of a channel.

data Shutdown Source

A ubiquitous shutdown signal that can be used to maintain a consistent shutdown/stop protocol for any process that wishes to handle it.



data ExitReason Source

Provides a reason for process termination.



indicates normal exit


normal response to a Shutdown

ExitOther !String

abnormal (error) shutdown

class (NFData a, Serializable a) => NFSerializable a Source

Introduces a class that brings NFData into scope along with Serializable, such that we can force evaluation. Intended for use with the UnsafePrimitives module (which wraps Control.Distributed.Process.UnsafePrimitives), and guarantees evaluatedness in terms of NFData. Please note that we cannot guarantee that an NFData instance will behave the same way as a Binary one with regards evaluation, so it is still possible to introduce unexpected behaviour by using unsafe primitives in this way.