aws-kinesis-reshard-0.1.0.1: Reshard AWS Kinesis streams in response to Cloud Watch metrics

Safe HaskellNone
LanguageHaskell2010

Aws.Kinesis.Reshard.Monad

Synopsis

Documentation

class Monad m => MonadError e m | m -> e where

The strategy of combining computations that can throw exceptions by bypassing bound functions from the point an exception is thrown to the point that it is handled.

Is parameterized over the type of error information and the monad type constructor. It is common to use Either String as the monad type constructor for an error monad in which error descriptions take the form of strings. In that case and many other common cases the resulting monad is already defined as an instance of the MonadError class. You can also define your own error type and/or use a monad type constructor other than Either String or Either IOError. In these cases you will have to explicitly define instances of the Error and/or MonadError classes.

Methods

throwError :: e -> m a

Is used within a monadic computation to begin exception processing.

catchError :: m a -> (e -> m a) -> m a

A handler function to handle previous errors and return to normal execution. A common idiom is:

do { action1; action2; action3 } `catchError` handler

where the action functions can call throwError. Note that handler and the do-block must have the same return type.

Instances

MonadError IOException IO 
MonadError e m => MonadError e (ResourceT m) 
MonadError e m => MonadError e (MaybeT m) 
MonadError e m => MonadError e (ListT m) 
MonadError e m => MonadError e (IdentityT m) 
MonadError e (Either e) 
Monad m => MonadError e (EitherT e m) 
(Monoid w, MonadError e m) => MonadError e (WriterT w m) 
(Monoid w, MonadError e m) => MonadError e (WriterT w m) 
MonadError e m => MonadError e (StateT s m) 
MonadError e m => MonadError e (StateT s m) 
MonadError e m => MonadError e (ReaderT r m) 
Monad m => MonadError e (ExceptT e m) 
(Monad m, Error e) => MonadError e (ErrorT e m) 
MonadError e m => MonadError e (ConduitM i o m) 
(Monoid w, MonadError e m) => MonadError e (RWST r w s m) 
(Monoid w, MonadError e m) => MonadError e (RWST r w s m) 
MonadError e m => MonadError e (Pipe l i o u m) 

class Monad m => MonadReader r m | m -> r where

See examples in Control.Monad.Reader. Note, the partially applied function type (->) r is a simple reader monad. See the instance declaration below.

Minimal complete definition

(ask | reader), local

Methods

ask :: m r

Retrieves the monad environment.

local

Arguments

:: (r -> r)

The function to modify the environment.

-> m a

Reader to run in the modified environment.

-> m a 

Executes a computation in a modified environment.

reader

Arguments

:: (r -> a)

The selector function to apply to the environment.

-> m a 

Retrieves a function of the current environment.

Instances

MonadReader r m => MonadReader r (ResourceT m) 
MonadReader r m => MonadReader r (MaybeT m) 
MonadReader r m => MonadReader r (ListT m) 
MonadReader r m => MonadReader r (IdentityT m) 
MonadReader r ((->) r) 
MonadReader s (ReifiedGetter s) 
MonadReader s (ReifiedFold s) 
MonadReader r m => MonadReader r (EitherT e m) 
MonadReader r m => MonadReader r (RandT g m) 
(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
MonadReader r m => MonadReader r (StateT s m) 
MonadReader r m => MonadReader r (StateT s m) 
Monad m => MonadReader r (ReaderT r m) 
MonadReader r m => MonadReader r (ExceptT e m) 
(Error e, MonadReader r m) => MonadReader r (ErrorT e m) 
MonadReader r' m => MonadReader r' (ContT r m) 
Monad m => MonadReader AWSSettings (AWS context m) 
MonadReader r m => MonadReader r (ConduitM i o m) 
(Monad m, Monoid w) => MonadReader r (RWST r w s m) 
(Monad m, Monoid w) => MonadReader r (RWST r w s m) 
MonadReader r m => MonadReader r (Pipe l i o u m) 

class Monad m => MonadIO m where

Monads in which IO computations may be embedded. Any monad built by applying a sequence of monad transformers to the IO monad will be an instance of this class.

Instances should satisfy the following laws, which state that liftIO is a transformer of monads:

Methods

liftIO :: IO a -> m a

Lift a computation from the IO monad.

Instances

MonadIO IO 
MonadIO m => MonadIO (IdentityT m) 
MonadIO m => MonadIO (MaybeT m) 
MonadIO m => MonadIO (ListT m) 
MonadIO m => MonadIO (ResourceT m) 
MonadIO m => MonadIO (RandT g m) 
MonadIO m => MonadIO (AWS context m) 
(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
MonadIO m => MonadIO (StateT s m) 
MonadIO m => MonadIO (StateT s m) 
MonadIO m => MonadIO (ReaderT r m) 
(Error e, MonadIO m) => MonadIO (ErrorT e m) 
MonadIO m => MonadIO (EitherT e m) 
MonadIO m => MonadIO (ContT r m) 
MonadIO m => MonadIO (ExceptT e m) 
MonadIO m => MonadIO (ConduitM i o m) 
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
MonadIO m => MonadIO (Pipe l i o u m) 

class MonadBase b m => MonadBaseControl b m | m -> b where

Associated Types

data StM m $a

Monadic state of m.

Methods

liftBaseWith :: (RunInBase m b -> b a) -> m a

liftBaseWith is similar to liftIO and liftBase in that it lifts a base computation to the constructed monad.

Instances should satisfy similar laws as the MonadIO and MonadBase laws:

liftBaseWith . const . return = return
liftBaseWith (const (m >>= f)) = liftBaseWith (const m) >>= liftBaseWith . const . f

The difference with liftBase is that before lifting the base computation liftBaseWith captures the state of m. It then provides the base computation with a RunInBase function that allows running m computations in the base monad on the captured state.

restoreM :: StM m a -> m a

Construct a m computation from the monadic state of m that is returned from a RunInBase function.

Instances should satisfy:

liftBaseWith (\runInBase -> runInBase m) >>= restoreM = m

class (MonadThrow m, MonadIO m, Applicative m, MonadBase IO m) => MonadResource m where

A Monad which allows for safe resource allocation. In theory, any monad transformer stack included a ResourceT can be an instance of MonadResource.

Note: runResourceT has a requirement for a MonadBaseControl IO m monad, which allows control operations to be lifted. A MonadResource does not have this requirement. This means that transformers such as ContT can be an instance of MonadResource. However, the ContT wrapper will need to be unwrapped before calling runResourceT.

Since 0.3.0

Methods

liftResourceT :: ResourceT IO a -> m a

Lift a ResourceT IO action into the current Monad.

Since 0.4.0