Network-NineP-0.4.2: High-level abstraction over 9P protocol

StabilityUltra-Violence
PortabilityI'm too young to die
Safe HaskellSafe
LanguageHaskell98

Control.Monad.EmbedIO

Description

Provides one with the ability to pass her own monads in the callbacks.

Synopsis

Documentation

class MonadIO o => EmbedIO o where Source #

MonadIOs that can be collapsed to and restored from a distinct value.

Minimal complete definition

embed, callback

Associated Types

type Content o Source #

Intermediate state storage type.

Methods

embed :: (Content o -> IO a) -> o a Source #

Propagate an IO operation over the storage type to the monadic type.

callback :: o a -> Content o -> IO a Source #

Run the monadic computation using supplied state.

Instances

EmbedIO IO Source # 

Associated Types

type Content (IO :: * -> *) :: * Source #

Methods

embed :: (Content IO -> IO a) -> IO a Source #

callback :: IO a -> Content IO -> IO a Source #

data Void Source #

Empty type. Used to represent state for IO monad.

bracketE :: EmbedIO m => m r -> (r -> m b) -> (r -> m a) -> m a Source #

bracket equivalent.

catchE :: (EmbedIO m, Exception e) => m a -> (e -> m a) -> m a Source #

catch equivalent.

handleE :: (EmbedIO m, Exception e) => (e -> m a) -> m a -> m a Source #

handle equivalent.

tryE :: (EmbedIO m, Exception e) => m a -> m (Either e a) Source #

try equivalent.

throwE :: (EmbedIO m, Exception e) => e -> m a Source #

throw equivalent.

forkE :: EmbedIO m => m () -> m ThreadId Source #

forkIO equivalent.