Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Internal prelude.
- module Prelude
- module Control.Monad
- class Monad m => MonadError e (m :: * -> *) | m -> e where
- data ExceptT e (m :: * -> *) a :: * -> (* -> *) -> * -> *
- runExceptT :: ExceptT e m a -> m (Either e a)
- throwError :: MonadError e m => forall a. e -> m a
- class Monad m => MonadIO (m :: * -> *) where
- liftIO :: MonadIO m => forall a. IO a -> m a
- class Monad m => MonadState s (m :: * -> *) | m -> s where
- newtype StateT s (m :: * -> *) a :: * -> (* -> *) -> * -> * = StateT {
- runStateT :: s -> m (a, s)
- modify :: MonadState s m => (s -> s) -> m ()
- get :: MonadState s m => m s
- put :: MonadState s m => s -> m ()
- class MonadTrans (t :: (* -> *) -> * -> *) where
- lift :: MonadTrans t => forall (m :: * -> *) a. Monad m => m a -> t m a
- foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- module Data.Monoid
- class IsString a where
Re-exports
module Prelude
Monads
module Control.Monad
Monad Transformers
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
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 Either
StringMonadError
class.
You can also define your own error type and/or use a monad type constructor
other than
or Either
String
.
In these cases you will have to explicitly define instances of the Either
IOError
Error
and/or MonadError
classes.
throwError :: e -> m a #
Is used within a monadic computation to begin exception processing.
MonadError IOException IO | |
MonadError ServantError ClientM | |
MonadError e m => MonadError e (MaybeT m) | |
MonadError e m => MonadError e (ListT m) | |
MonadError e (Either e) | |
(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 (IdentityT * m) | |
Monad m => MonadError e (ExceptT e m) | |
(Monad m, Error e) => MonadError e (ErrorT e m) | |
MonadError e m => MonadError e (ReaderT * r 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) | |
data ExceptT e (m :: * -> *) a :: * -> (* -> *) -> * -> * #
A monad transformer that adds exceptions to other monads.
ExceptT
constructs a monad parameterized over two things:
- e - The exception type.
- m - The inner monad.
The return
function yields a computation that produces the given
value, while >>=
sequences two subcomputations, exiting on the
first exception.
runExceptT :: ExceptT e m a -> m (Either e a) #
The inverse of ExceptT
.
throwError :: MonadError e m => forall a. e -> m a #
Is used within a monadic computation to begin exception processing.
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:
MonadIO IO | Since: 4.9.0.0 |
MonadIO ClientM | |
MonadIO WithRemoteHost # | |
MonadIO WithLocalHost # | |
MonadIO m => MonadIO (ListT m) | |
MonadIO m => MonadIO (MaybeT m) | |
MonadIO m => MonadIO (IdentityT * m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
MonadIO m => MonadIO (StateT s m) | |
MonadIO m => MonadIO (ExceptT e m) | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (StateT s m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
MonadIO m => MonadIO (ReaderT * r m) | |
MonadIO m => MonadIO (ContT * r m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
class Monad m => MonadState s (m :: * -> *) | m -> s where #
Minimal definition is either both of get
and put
or just state
Return the state from the internals of the monad.
Replace the state inside the monad.
MonadState s m => MonadState s (MaybeT m) | |
MonadState s m => MonadState s (ListT m) | |
Monad m => MonadState s (StateT s m) | |
(Monoid w, MonadState s m) => MonadState s (WriterT w m) | |
(Monoid w, MonadState s m) => MonadState s (WriterT w m) | |
Monad m => MonadState s (StateT s m) | |
MonadState s m => MonadState s (IdentityT * m) | |
MonadState s m => MonadState s (ExceptT e m) | |
(Error e, MonadState s m) => MonadState s (ErrorT e m) | |
MonadState s m => MonadState s (ReaderT * r m) | |
MonadState s m => MonadState s (ContT * r m) | |
(Monad m, Monoid w) => MonadState s (RWST r w s m) | |
(Monad m, Monoid w) => MonadState s (RWST r w s m) | |
newtype StateT s (m :: * -> *) a :: * -> (* -> *) -> * -> * #
A state transformer monad parameterized by:
s
- The state.m
- The inner monad.
The return
function leaves the state unchanged, while >>=
uses
the final state of the first computation as the initial state of
the second.
MonadBaseControl b m => MonadBaseControl b (StateT s m) | |
Monad m => MonadState s (StateT s m) | |
MonadReader r m => MonadReader r (StateT s m) | |
MonadError e m => MonadError e (StateT s m) | |
MonadTrans (StateT s) | |
MonadTransControl (StateT s) | |
Monad m => Monad (StateT s m) | |
Functor m => Functor (StateT s m) | |
MonadFix m => MonadFix (StateT s m) | |
MonadFail m => MonadFail (StateT s m) | |
(Functor m, Monad m) => Applicative (StateT s m) | |
(Functor m, MonadPlus m) => Alternative (StateT s m) | |
MonadPlus m => MonadPlus (StateT s m) | |
MonadIO m => MonadIO (StateT s m) | |
MonadThrow m => MonadThrow (StateT s m) | |
MonadCatch m => MonadCatch (StateT s m) | |
MonadMask m => MonadMask (StateT s m) | |
PrimMonad m => PrimMonad (StateT s m) | |
type StT (StateT s) a | |
type PrimState (StateT s m) | |
type StM (StateT s m) a | |
modify :: MonadState s m => (s -> s) -> m () #
Monadic state transformer.
Maps an old state to a new state inside a state monad. The old state is thrown away.
Main> :t modify ((+1) :: Int -> Int) modify (...) :: (MonadState Int a) => a ()
This says that modify (+1)
acts over any
Monad that is a member of the MonadState
class,
with an Int
state.
get :: MonadState s m => m s #
Return the state from the internals of the monad.
put :: MonadState s m => s -> m () #
Replace the state inside the monad.
class MonadTrans (t :: (* -> *) -> * -> *) where #
The class of monad transformers. Instances should satisfy the
following laws, which state that lift
is a monad transformation:
lift :: Monad m => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.
MonadTrans ListT | |
MonadTrans MaybeT | |
MonadTrans (IdentityT *) | |
Monoid w => MonadTrans (WriterT w) | |
MonadTrans (StateT s) | |
MonadTrans (ExceptT e) | |
MonadTrans (ErrorT e) | |
MonadTrans (StateT s) | |
Monoid w => MonadTrans (WriterT w) | |
MonadTrans (ReaderT * r) | |
MonadTrans (ContT * r) | |
Monoid w => MonadTrans (RWST r w s) | |
Monoid w => MonadTrans (RWST r w s) | |
lift :: MonadTrans t => forall (m :: * -> *) a. Monad m => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.
Foldable
foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b #
Monadic fold over the elements of a structure, associating to the left, i.e. from left to right.
Monoid
module Data.Monoid
Strings
Class for string-like datastructures; used by the overloaded string extension (-XOverloadedStrings in GHC).
fromString :: String -> a #
IsString ByteString | |
IsString ByteString | |
IsString Value | |
IsString String | |
IsString RequestBody | Since 0.4.12 |
IsString MediaType | |
IsString Doc | |
IsString OperationId # | |
IsString PoolName # | |
IsString ProfileName # | |
IsString NetworkName # | |
IsString ImageAliasName # | |
IsString LocalContainer # | |
IsString FileType # | |
IsString FileMode # | |
IsString LocalImageByAlias # | |
IsString ContainerName # | |
(~) * a Char => IsString [a] |
Since: 2.1 |
IsString a => IsString (Identity a) | |
(IsString s, FoldCase s) => IsString (CI s) | |
IsString (Seq Char) | |
(~) * a Char => IsString (DList a) | |
(IsString a, Hashable a) => IsString (Hashed a) | |
IsString (Doc a) | |
IsString a => IsString (Const * a b) | Since: 4.9.0.0 |
IsString a => IsString (Tagged k s a) | |