Copyright | (c) Samuel Schlesinger 2020 |
---|---|
License | MIT |
Maintainer | sgschlesinger@gmail.com |
Stability | experimental |
Portability | POSIX, Windows |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- data ActionT message m a
- data Actor message
- send :: Actor message -> message -> STM ()
- addAfterEffect :: Actor message -> (Maybe SomeException -> IO ()) -> STM ()
- threadId :: Actor message -> ThreadId
- actFinally :: (Either SomeException a -> IO ()) -> ActionT message IO a -> IO (Actor message)
- act :: ActionT message IO a -> IO (Actor message)
- receiveSTM :: MonadIO m => (message -> STM a) -> ActionT message m a
- receive :: MonadIO m => (message -> ActionT message m a) -> ActionT message m a
- hoistActionT :: (forall x. m x -> n x) -> ActionT message m a -> ActionT message n a
- link :: MonadIO m => Actor message -> ActionT message' m ()
- linkSTM :: Actor message -> Actor message' -> STM ()
- data LinkKill = LinkKill ThreadId
- self :: Applicative m => ActionT message m (Actor message)
- murder :: MonadIO m => Actor message -> m ()
- data MurderKill = MurderKill ThreadId
Documentation
data ActionT message m a Source #
A type that contains the actions that Actor
s will do.
Instances
A handle to do things to actors, like sending them messages, fiddling with their threads, or adding an effect that will occur after they've finished executing.
addAfterEffect :: Actor message -> (Maybe SomeException -> IO ()) -> STM () Source #
actFinally :: (Either SomeException a -> IO ()) -> ActionT message IO a -> IO (Actor message) Source #
Perform some ActionT
in a thread, with some cleanup afterwards.
receiveSTM :: MonadIO m => (message -> STM a) -> ActionT message m a Source #
Receive a message and, in the same transaction, produce some result.
receive :: MonadIO m => (message -> ActionT message m a) -> ActionT message m a Source #
Receive a message and do some ActionT
with it.
hoistActionT :: (forall x. m x -> n x) -> ActionT message m a -> ActionT message n a Source #
Use a natural transformation to transform an ActionT
on one base
monad to another.
The exception thrown when an actor we've link
ed with has died.
Instances
Show LinkKill Source # | |
Exception LinkKill Source # | |
Defined in Control.Concurrent.Actor toException :: LinkKill -> SomeException # fromException :: SomeException -> Maybe LinkKill # displayException :: LinkKill -> String # |
self :: Applicative m => ActionT message m (Actor message) Source #
Returns the Actor
handle of the actor executing this action.
murder :: MonadIO m => Actor message -> m () Source #
Throws a MurderKill
exception to the given Actor
.
data MurderKill Source #
Instances
Show MurderKill Source # | |
Defined in Control.Concurrent.Actor showsPrec :: Int -> MurderKill -> ShowS # show :: MurderKill -> String # showList :: [MurderKill] -> ShowS # | |
Exception MurderKill Source # | |
Defined in Control.Concurrent.Actor toException :: MurderKill -> SomeException # fromException :: SomeException -> Maybe MurderKill # displayException :: MurderKill -> String # |