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

Copyright | Josef Svenningsson 2008-2010 (c) The University of Glasgow, 1994-2000
License | BSD
Maintainer | josef.svenningsson@gmail.com
Stability | experimental
Portability | non-portable (GHC Extensions)
Safe Haskell | None
Language | Haskell98

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

- newtype STT s m a = STT (State# s -> m (STTRet s a))
- unSTT :: STT s m a -> State# s -> m (STTRet s a)
- data STTRet s a = STTRet (State# s) a

# Documentation

newtype STT s m a Source

`STT` is the monad transformer providing polymorphic updateable references

Constructors

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

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 |