Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data ActorRef m
- data ActorIO m a
- noop :: ActorIO m ()
- liftIO :: MonadIO m => forall a. IO a -> m a
- actor :: Show m => String -> (m -> ActorIO m ()) -> ActorIO m (ActorRef m)
- tell :: ActorRef m -> m -> ActorRef m -> ActorIO m ()
- (!) :: ActorRef m -> m -> ActorIO m ()
- forward :: ActorRef m -> m -> ActorIO m ()
- schedule :: Int -> Int -> ActorRef m -> m -> ActorIO m Cancellable
- scheduleOnce :: Int -> ActorRef m -> m -> ActorIO m Cancellable
- sender :: ActorIO m (ActorRef m)
- self :: ActorIO m (ActorRef m)
- parent :: ActorIO m (ActorRef m)
- log :: Severity -> String -> ActorIO m ()
- data Severity
- become :: (m -> ActorIO m ()) -> ActorIO m ()
- stop :: ActorIO m ()
- actorSystem :: Show m => String -> ActorIO m a -> IO ActorSystem
- data ActorSystem
- terminate :: ActorSystem -> IO ()
- data Cancellable
- cancel :: Cancellable -> ActorIO m ()
Actors
Serializable handle to an Actor
The ActorIO Monad
Actions which actors execute in response to a received message run within the ActorIO monad.
Creating Actors
:: Show m | |
=> String | The name of the actor. Must be url safe and unique within the context. |
-> (m -> ActorIO m ()) | The message handler of the actor. |
-> ActorIO m (ActorRef m) | An |
Create a new child actor in the current context (actor system or actor).
Sending messages
:: ActorRef m | The recipient of the message |
-> m | The message to send |
-> ActorRef m | The sender of the message |
-> ActorIO m () |
Send a message to an actor. Does not block (immediately returns control flow).
Like tell
but the sender will be the actor which executes the action.
Like tell
but the sender will be the sender of the currently processed message.
:: Int | Delay in milliseconds before the first message gets sent. |
-> Int | Delay in milliseconds between two subsequent messages |
-> ActorRef m | The reference to the receiving actor (Dereferenced in the future) |
-> m | The message |
-> ActorIO m Cancellable |
Schedule the delivery of a message in the future
:: Int | Delay in milliseconds before the message gets sent. |
-> ActorRef m | The reference to the receiving actor (Dereferenced in the future) |
-> m | The message |
-> ActorIO m Cancellable |
Schedule the delivery of a message in the future
Known ActorRefs
sender :: ActorIO m (ActorRef m) Source #
Obtain the reference to the sender of the currently processed message
Logging
Log a message. Log messages will be sequentialized.
Changing the behavior
Switch the behavior of the current actor
Actor Systems
:: Show m | |
=> String | The name of the system. Must be url safe and unique within the process. |
-> ActorIO m a | Action to initialize the system. Runs within the context of the root actor. |
-> IO ActorSystem |
Create a new actor system
data ActorSystem Source #
An ActorSystem serves as the root of an actor hierarchy
terminate :: ActorSystem -> IO () Source #
Terminate the actor System
Util
data Cancellable Source #
cancel :: Cancellable -> ActorIO m () Source #