Safe Haskell | None |
---|
This module provides a server process (implemented using eprocess) that can receive and run actions in the Interpreter monad.
- data ServerHandle
- start :: IO ServerHandle
- stop :: ServerHandle -> IO ()
- runIn :: ServerHandle -> InterpreterT IO a -> IO (Either InterpreterError a)
- asyncRunIn :: ServerHandle -> InterpreterT IO a -> IO (MVar (Either InterpreterError a))
- flush :: ServerHandle -> IO (Either InterpreterError ())
Types
data ServerHandle Source
The server handle. It's returned on process creation and should be used afterwards to send messages to it
Functions
start :: IO ServerHandleSource
Starts the server. Usage:
handle <- start
stop :: ServerHandle -> IO ()Source
Stops the server. Usage:
stop serverhandle
:: ServerHandle | The handle of the server that will run the action |
-> InterpreterT IO a | The action to be run |
-> IO (Either InterpreterError a) |
Runs the action. Usage:
result <- runIn serverhandle action
:: ServerHandle | The handle of the server that will run the action |
-> InterpreterT IO a | The action to be run |
-> IO (MVar (Either InterpreterError a)) |
Asynchronically runs an action and returns the MVar that will be filled
with the result when it's there. Usage:
mvar <- asyncRunIn serverhandle action
:: ServerHandle | The handle of the server that will run the action |
-> IO (Either InterpreterError ()) | The meaningful results are stored in the corresponding mvars |
Runs all the pending actions (those that where run using asyncRunIn
. Usage:
flush serverhandle