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

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

Control.Monad.EmbedIO

Description

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

Synopsis

Documentation

class MonadIO o => EmbedIO o whereSource

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

Associated Types

type Content o Source

Intermediate state storage type.

Methods

embed :: (Content o -> IO a) -> o aSource

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

callback :: o a -> Content o -> IO aSource

Run the monadic computation using supplied state.

Instances

data Void Source

Empty type. Used to represent state for IO monad.

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

bracket equivalent.

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

catch equivalent.

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

handle equivalent.

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

try equivalent.

throwE :: (EmbedIO m, Exception e) => e -> m aSource

throw equivalent.

forkE :: EmbedIO m => m () -> m ThreadIdSource

forkIO equivalent.