Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
-
class
Monad
m =>
MonadST
m
where
- withLiftST :: ( forall s. ( forall a. ST s a -> m a) -> b) -> b
Documentation
class Monad m => MonadST m where Source #
This class is for abstracting over
stToIO
which allows running
ST
actions in
IO
. In this case it is to allow running
ST
actions within
another monad
m
.
The type of
stToIO
is:
stToIO : ST RealWorld a -> IO a
Abstracting over this is tricky because we need to not care about both
the
IO
, and also the
RealWorld
.
A solution is to write an action that is given the
liftST
as an argument
and where that action itself is polymorphic in the
s
parameter. This
allows us to instantiate it with
RealWorld
in the
IO
case, and the local
s
in a case where we are embedding into another
ST
action.
withLiftST :: ( forall s. ( forall a. ST s a -> m a) -> b) -> b Source #
Instances
MonadST IO Source # | |
Defined in Control.Monad.Class.MonadST withLiftST :: ( forall s. ( forall a. ST s a -> IO a) -> b) -> b Source # |
|
MonadST ( ST s) Source # | |
Defined in Control.Monad.Class.MonadST withLiftST :: ( forall s0. ( forall a. ST s0 a -> ST s a) -> b) -> b Source # |
|
MonadST m => MonadST ( ReaderT r m) Source # | |
Defined in Control.Monad.Class.MonadST withLiftST :: ( forall s. ( forall a. ST s a -> ReaderT r m a) -> b) -> b Source # |