| 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
- 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
| (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) # | |
| (Functor m, Monad m) => Applicative (StateCache c m) # | |
| MonadIO m => MonadIO (StateCache c m) # | |
| (Functor m, MonadPlus m) => Alternative (StateCache c m) # | |
| MonadPlus m => MonadPlus (StateCache c m) # | |
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