Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data RealWorld :: Type
- data IO a
- class Monad m => MonadIO (m :: Type -> Type) where
- liftPrim :: (PrimBase m1, PrimMonad m2, PrimState m1 ~ PrimState m2) => m1 a -> m2 a
- primitive_ :: PrimMonad m => (State# (PrimState m) -> State# (PrimState m)) -> m ()
- class Monad m => PrimMonad (m :: Type -> Type) where
- class PrimMonad m => PrimBase (m :: Type -> Type)
Documentation
RealWorld
is deeply magical. It is primitive, but it is not
unlifted (hence ptrArg
). We never manipulate values of type
RealWorld
; it's only used in the type system, to parameterise State#
.
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
There is really only one way to "perform" an I/O action: bind it to
Main.main
in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO
monad and called
at some point, directly or indirectly, from Main.main
.
IO
is a monad, so IO
actions can be combined using either the do-notation
or the >>
and >>=
operations from the Monad
class.
Instances
class Monad m => MonadIO (m :: Type -> Type) 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:
Instances
MonadIO IO | Since: base-4.9.0.0 |
Defined in Control.Monad.IO.Class | |
MonadIO Q | |
Defined in Language.Haskell.TH.Syntax | |
MonadIO m => MonadIO (MaybeT m) | |
Defined in Control.Monad.Trans.Maybe | |
MonadIO m => MonadIO (IdentityT m) | |
Defined in Control.Monad.Trans.Identity | |
MonadIO m => MonadIO (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
(Functor f, MonadIO m) => MonadIO (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
Defined in Control.Monad.Trans.Error |
primitive_ :: PrimMonad m => (State# (PrimState m) -> State# (PrimState m)) -> m () #
Execute a primitive operation with no result
class Monad m => PrimMonad (m :: Type -> Type) where #
Class of monads which can perform primitive state-transformer actions
primitive :: (State# (PrimState m) -> (#State# (PrimState m), a#)) -> m a #
Execute a primitive operation
Instances
PrimMonad IO | |
PrimMonad (ST s) | |
PrimMonad m => PrimMonad (MaybeT m) | |
PrimMonad m => PrimMonad (ListT m) | |
PrimMonad m => PrimMonad (IdentityT m) | |
PrimMonad m => PrimMonad (ExceptT e m) | |
(Error e, PrimMonad m) => PrimMonad (ErrorT e m) | |
PrimMonad m => PrimMonad (StateT s m) | |
PrimMonad m => PrimMonad (StateT s m) | |
(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) | |
(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) | |
(Monoid w, PrimMonad m) => PrimMonad (AccumT w m) | Since: primitive-0.6.3.0 |
PrimMonad m => PrimMonad (SelectT r m) | |
PrimMonad m => PrimMonad (ContT r m) | Since: primitive-0.6.3.0 |
PrimMonad m => PrimMonad (ReaderT r m) | |
(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) | |
(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) | |
class PrimMonad m => PrimBase (m :: Type -> Type) #
Class of primitive monads for state-transformer actions.
Unlike PrimMonad
, this typeclass requires that the Monad
be fully
expressed as a state transformer, therefore disallowing other monad
transformers on top of the base IO
or ST
.
Since: primitive-0.6.0.0