persistent-refs-0.3: Haskell references backed by an IntMap for persistence and reversibility.

Portabilitynon-portable (requires rank-2 types for runST)
Stabilityexperimental
Maintaineracfoltzer@gmail.com
Safe HaskellNone

Control.Monad.ST.Persistent

Contents

Description

This library provides support for a persistent version of the ST monad. Internally, references are backed by a IntMap, rather than being mutable variables on the heap. This decreases performance, but can be useful in certain settings, particularly those involving backtracking.

Synopsis

The Persistent ST Monad

type ST s = STT s IdentitySource

A persistent version of the ST monad.

runST :: (forall s. ST s a) -> aSource

Run a computation that uses persistent references, and return a pure value. The rank-2 type offers similar guarantees to runST.

The Persistent ST Monad transformer

data STT s m a Source

Instances

MonadTrans (STT s) 
Monad m => MonadRef (STRef s) (STT s m) 
Monad m => Monad (STT s m) 
Functor m => Functor (STT s m) 
MonadPlus m => MonadPlus (STT s m) 
(Monad m, Functor m) => Applicative (STT s m) 
(Functor m, MonadPlus m) => Alternative (STT s m) 
MonadIO m => MonadIO (STT s m) 

runSTT :: Monad m => (forall s. STT s m a) -> m aSource

Run a computation that uses persistent references, and return a pure value. The rank-2 type offers similar guarantees to runST.