Portability | non-portable (multi-param classes, flexible instances) |
---|---|
Stability | experimental |
Maintainer | eduard.sergeev@gmail.com |
Safe Haskell | Safe-Inferred |
Defines MemoStateT - generalized (to any Data.MapLike content) memoization monad transformer
- type MemoStateT s k v = StateCache (Container s)
- runMemoStateT :: Monad m => MemoStateT s k v m a -> s -> m (a, s)
- evalMemoStateT :: Monad m => MemoStateT c k v m a -> c -> m a
- type MemoState c k v = MemoStateT c k v Identity
- runMemoState :: MemoState c k v a -> c -> (a, c)
- evalMemoState :: MemoState c k v a -> c -> a
- newtype Container s = Container {
- toState :: s
MemoStateT monad transformer
type MemoStateT s k v = StateCache (Container s)Source
Memoization monad transformer based on StateCache
to be used with pure cache containers which support MapLike
interface
runMemoStateT :: Monad m => MemoStateT s k v m a -> s -> m (a, s)Source
Returns the pair of the result of MonadMemo
computation
along with the final state of the internal pure container wrapped in monad
evalMemoStateT :: Monad m => MemoStateT c k v m a -> c -> m aSource
Returns the result of MonadMemo
computation wrapped in monad.
This function discards the cache
MemoState monad
type MemoState c k v = MemoStateT c k v IdentitySource
Memoization monad based on StateCache
to be used with pure cache containers which support MapLike
interface
runMemoState :: MemoState c k v a -> c -> (a, c)Source
Returns the pair of the result of MonadMemo
computation
along with the final state of the internal pure container
evalMemoState :: MemoState c k v a -> c -> aSource
Returns the result of MonadMemo
computation discarding the cache
Internal
(Monad m, MapLike c k v) => MonadMemo k v (MemoStateT c k v m) | |
(Monad m, MapLike c k v) => MonadCache k v (MemoStateT c k v m) |