| Copyright | (c) Eduard Sergeev 2013 |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | eduard.sergeev@gmail.com |
| Stability | experimental |
| Portability | non-portable (multi-param classes, flexible instances) |
| Safe Haskell | Safe |
| Language | Haskell98 |
Control.Monad.Trans.Memo.StateCache
Description
Generic StateCache - similar to StateT but optimised for carrying cache container
Synopsis
- newtype StateCache c m a = StateCache {
- runStateCache :: c -> m (a, c)
- container :: Monad m => StateCache c m c
- setContainer :: Monad m => c -> StateCache c m ()
- evalStateCache :: Monad m => StateCache c m a -> c -> m a
Documentation
newtype StateCache c m a #
Generic memoization cache which uses provided container which can also be updated by the computation.
This is pretty much identical to StateT,
but is tuned to speed up implementations which use unboxed mutable containers
Constructors
| StateCache | |
Fields
| |
Instances
container :: Monad m => StateCache c m c #
Returns internal container
setContainer :: Monad m => c -> StateCache c m () #
Assigns new value to internal container
evalStateCache :: Monad m => StateCache c m a -> c -> m a #
Evaluates computation discarding the resulting container