Copyright (c) Eduard Sergeev 2011 BSD-style (see the file LICENSE) eduard.sergeev@gmail.com experimental non-portable (multi-param classes, flexible instances) None Haskell2010

Description

Defines MemoStateT - generalized (to any Data.MapLike content) memoization monad transformer

Synopsis

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 a Source #

Returns the result of MonadMemo computation wrapped in monad. This function discards the cache

type MemoState c k v = MemoStateT c k v Identity Source #

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 -> a Source #

Returns the result of MonadMemo computation discarding the cache

# Internal

newtype Container s Source #

Constructors

 Container FieldstoState :: s
Instances
 (Monad m, MapLike c k v) => MonadMemo k v (MemoStateT c k v m) Source # Instance detailsDefined in Control.Monad.Trans.Memo.State Methodsmemo :: (k -> MemoStateT c k v m v) -> k -> MemoStateT c k v m v Source # (Monad m, MapLike c k v) => MonadCache k v (MemoStateT c k v m) Source # Instance detailsDefined in Control.Monad.Trans.Memo.State Methodslookup :: k -> MemoStateT c k v m (Maybe v) Source #add :: k -> v -> MemoStateT c k v m () Source #