- type Actor i = i -> ActorM (NextActor i)
- type Loop = ActorM (NextActor ())
- newtype NextActor i = NextActor {}
- data ActorM a
- continue :: Actor i -> ActorM (NextActor i)
- continue_ :: Loop -> ActorM (NextActor i)
- done :: ActorM (NextActor i)
- aseq :: Actor i -> Actor i -> Actor i
- send :: Action m => Mailbox a -> a -> m ()
- receive :: Mailbox o -> IO o
- receiveList :: Mailbox o -> IO [o]
- data Mailbox i
- newMailbox :: Action m => m (Mailbox a)
- class Monad m => Action m
- forkActor :: Action m => Actor i -> m (Mailbox i)
- forkActorUsing :: Action m => Mailbox i -> Actor i -> m ()
- forkLoop :: Action m => Loop -> m ()
- runActorUsing :: Mailbox i -> Actor i -> IO ()
- runLoop :: Loop -> IO ()
Actor computations
The Actor encironment in which Actors can be spawned and sent messages
Building Actors
aseq :: Actor i -> Actor i -> Actor iSource
compose two actors. The second will take over when the first exits
Message passing and IO
send :: Action m => Mailbox a -> a -> m ()Source
Send a message to an Actor. Actors can only be passed messages from other actors.
Actor system output:
receive :: Mailbox o -> IO oSource
Read a message from a mailbox in the IO monad. This can be used as the mechanism for output from an Actor system. Blocks if the actor is empty
receiveList :: Mailbox o -> IO [o]Source
Return a lazy list of mailbox contents
Mailbox
newMailbox :: Action m => m (Mailbox a)Source
create a new mailbox that Actors can be launched to read from or send messages to in order to communicate with other actors
Running Actors
class Monad m => Action m Source
monads in the Action class can participate in message passing and other Actor operations
forkActorUsing :: Action m => Mailbox i -> Actor i -> m ()Source
fork an actor that reads from the supplied Mailbox