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

Copyright(c) Adam C. Foltzer 2013
LicenseBSD3
Maintaineracfoltzer@gmail.com
Stabilityexperimental
Portabilitynon-portable (requires rank-2 types for runST)
Safe HaskellNone
LanguageHaskell98

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 Identity Source

A persistent version of the ST monad.

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

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) 
(Functor m, MonadPlus m) => Alternative (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) 
MonadIO m => MonadIO (STT s m) 

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

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