STMonadTrans-0.3.2: A monad transformer version of the ST monad

Portabilitynon-portable (GHC Extensions)
Stabilityexperimental
Maintainerjosef.svenningsson@gmail.com
Safe HaskellNone

Control.Monad.ST.Trans.Internal

Description

This module provides the implementation of the STT type for those occasions where it's needed in order to implement new liftings through operations in other monads.

Warning! This monad transformer should not be used with monads that can contain multiple answers, like the list monad. The reason is that the will be duplicated across the different answers and this cause Bad Things to happen (such as loss of referential transparency). Safe monads include the monads State, Reader, Writer, Maybe and combinations of their corresponding monad transformers.

Synopsis

Documentation

newtype STT s m a Source

STT is the monad transformer providing polymorphic updateable references

Constructors

STT (State# s -> m (STTRet s a)) 

Instances

MonadError e m => MonadError e (STT s m) 
MonadReader r m => MonadReader r (STT s m) 
MonadState s m => MonadState s (STT s' m) 
MonadWriter w m => MonadWriter w (STT s m) 
MonadTrans (STT s) 
Monad m => Monad (STT s m) 
Functor m => Functor (STT s m) 
MonadFix m => MonadFix (STT s m) 
(Monad m, Functor m) => Applicative (STT s m) 

unSTT :: STT s m a -> State# s -> m (STTRet s a)Source

data STTRet s a Source

STTRet is needed to encapsulate the unboxed state token that GHC passes around. This type is essentially a pair, but an ordinary pair is not not allowed to contain unboxed types.

Constructors

STTRet (State# s) a 

Instances