monad-memo-0.4.1: Memoization monad transformer

Portabilitynon-portable (multi-param classes, flexible instances)
Stabilityexperimental
Maintainereduard.sergeev@gmail.com
Safe HaskellSafe-Inferred

Control.Monad.Trans.Memo.StateCache

Description

Generic StateCache - similar to StateT but optimised for carrying cache container

Synopsis

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

runStateCache :: c -> m (a, c)
 

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