monad-memo-0.4.1: Memoization monad transformer

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

Control.Monad.Trans.Memo.Map

Contents

Description

Specialization of MemoStateT with Map as a container

Synopsis

MemoT monad transformer

type MemoT k v = MemoStateT (Map k v) k vSource

Memoization monad transformer which uses Map as a cache container

runMemoT :: Monad m => MemoT k v m a -> Map k v -> m (a, Map k v)Source

Given an initial cache, compute the result of a memoized computation along with the final state of the cache

evalMemoT :: Monad m => MemoT k v m a -> Map k v -> m aSource

Given an initial state, compute the result of a memoized computation discarding the final state of the cache

startRunMemoT :: Monad m => MemoT k v m a -> m (a, Map k v)Source

Compute the result of memoized computation along with the final state of the cache. This function uses empty Map as an initial state

startEvalMemoT :: Monad m => MemoT k v m a -> m aSource

Compute the result of a memoized computation discarding the final state of the cache. This function uses empty Map as an initial state

Memo monad

type Memo k v = MemoT k v IdentitySource

Memoization monad which uses Map as a cache container

runMemo :: Memo k v a -> Map k v -> (a, Map k v)Source

Given an initial cache, compute the result of a memoized computation along with the final state of the cache

evalMemo :: Memo k v a -> Map k v -> aSource

Given an initial state, compute the result of a memoized computation discarding the final state of the cache

startRunMemo :: Memo k v a -> (a, Map k v)Source

Compute the result of memoized computation along with the final state of the cache. This function uses empty Map as an initial state

startEvalMemo :: Memo k v a -> aSource

Compute the result of a memoized computation discarding the final state of the cache. This function uses empty Map as an initial state