IdrisDoc: System.Concurrency.Process

# System.Concurrency.Process

data ProcID : Type -> Type
  MkPID : Ptr -> ProcID msg
data Process : (msgType : Type) -> Type -> Type

  Type safe message passing programs. Parameterised over the type of
  message which can be send, and the return type.

  Lift : IO a -> Process msg a
create : Process msg () -> Process msg (ProcID msg)
msgWaiting : Process msg Bool

  Return whether a message is waiting in the queue

msgWaitingFrom : ProcID msg -> Process msg Bool

  Return whether a message is waiting in the queue from a specific sender

myID : Process msg (ProcID msg)

  Get current process ID

recv : Process msg msg

  Receive a message - blocks if there is no message waiting

recvFrom : ProcID msg -> Process msg (Maybe msg)

  Receive a message from specific sender - blocks if there is no message waiting
  Fails if the sender is no longer running

recvWithSender : Process msg (ProcID msg, msg)

  receive a message, and return with the sender's process ID.

run : Process msg x -> IO x
send : ProcID msg -> msg -> Process msg Bool

  Send a message to another process
  Returns whether the send was unsuccessful.