Network-NineP-0.4.1: 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 #

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

Minimal complete definition

embed, callback

Associated Types

type Content o #

Intermediate state storage type.

Methods

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

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

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

Run the monadic computation using supplied state.

Instances

EmbedIO IO # 

Associated Types

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

Methods

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

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

data Void #

Empty type. Used to represent state for IO monad.

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

bracket equivalent.

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

catch equivalent.

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

handle equivalent.

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

try equivalent.

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

throw equivalent.

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

forkIO equivalent.