distributed-process-lifted-0.3.0.1: monad-control style typeclass and transformer instances for Process monad.

Safe HaskellNone
LanguageHaskell2010

Control.Distributed.Process.Lifted.Extras

Description

Utility functions for working with Processes outside of the Process monad.

Synopsis

Documentation

fromProcess :: forall a m. MonadBase IO m => LocalNode -> Process a -> m a Source #

A variant of runProcess which returns a value. This works just like runProcess by forking a new process with a captured MVar, but it will return the result of the computation. If the computation throws an exception, it will be re-thrown by fromProcess in the calling thread.

data ProcessProxy Source #

Represents a handle to a process runner that communicates through a Chan. Create with spawnProxy or spawnProxyIO. Use this to call process actions (using fromProxy or inProxy) from any IO that will be executed in a single process that will have a persistent pid and mailbox across invocations. Sharing a single proxy between threads may yield poor performance and is not advised.

spawnProxy :: Process ProcessProxy Source #

Spawn a new process and return a ProcessProxy handle for it.

spawnProxyIO :: forall m. MonadBase IO m => LocalNode -> m ProcessProxy Source #

Same as spawnProxy but can be used from any IO

spawnProxyIO node = fromProcess node spawnProxy

inProxy :: forall m. MonadBase IO m => ProcessProxy -> Process () -> m () Source #

Use a ProcessProxy created with spawnProxy to run a Process computation in the existing Process asynchronously.

fromProxy :: forall a m. MonadBase IO m => ProcessProxy -> Process a -> m a Source #

Use a ProcessProxy created with spawnProxy to run a Process computation in the existing Process and return the result in any IO.