| Portability | non-portable (multi-param classes, flexible instances) |
|---|---|
| Stability | experimental |
| Maintainer | eduard.sergeev@gmail.com |
| Safe Haskell | Safe-Inferred |
Control.Monad.Trans.Memo.StateCache
Description
Generic StateCache - similar to StateT but optimised for carrying cache container
- 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 Source
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
| (PrimMonad m, ~ * (PrimState m) s, MaybeLike e v, MVector c e) => MonadMemo Int v (Cache c s e m) | |
| (Monad m, MapLike c k v) => MonadMemo k v (MemoStateT c k v m) | |
| (PrimMonad m, ~ * (PrimState m) s, MaybeLike e v, MVector c e) => MonadCache Int v (Cache c s e m) | |
| (Monad m, MapLike c k v) => MonadCache k v (MemoStateT c k v m) | |
| MonadTrans (StateCache c) | |
| Monad m => Monad (StateCache c m) | |
| Functor m => Functor (StateCache c m) | |
| MonadFix m => MonadFix (StateCache c m) | |
| MonadPlus m => MonadPlus (StateCache c m) | |
| (Functor m, Monad m) => Applicative (StateCache c m) | |
| (Functor m, MonadPlus m) => Alternative (StateCache c m) | |
| MonadIO m => MonadIO (StateCache c m) |
container :: Monad m => StateCache c m cSource
Returns internal container
setContainer :: Monad m => c -> StateCache c m ()Source
Assigns new value to internal container
evalStateCache :: Monad m => StateCache c m a -> c -> m aSource
Evaluates computation discarding the resulting container