The monad-memo package

[Tags: bsd3, library]

Memoization monad transformer supporting most of the standard monad transformers and a range of memoization cache types: from default pure maps to extremely fast mutable vectors

To add memoization behaviour to a monadic function:

1) Add Control.Monad.Memo.memo combinator at the point when memoization is required (i.e. recursive call)

import Control.Monad.Memo

fibm 0 = return 0
fibm 1 = return 1
fibm n = do
  n1 <- memo fibm (n-1)
  n2 <- memo fibm (n-2)
  return (n1+n2)

2) Use approprite *eval* or *run* function to evaluate resulting MonadMemo monad:

startEvalMemo (fibm 100)

See detailed description and examples: Control.Monad.Memo


Versions0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.0, 0.4.1
Dependenciesarray (>=0.3), base (>=3.0 && <=5.0), containers (>=0.3), mtl (>=2.0), primitive (>=0.3), transformers (>=0.2), vector (>=0.7)
AuthorEduard Sergeev
CategoryControl, Monad
Home page
Source repositoryhead: git clone
this: git clone 0.4.1)
UploadedWed Mar 6 05:25:47 UTC 2013 by EduardSergeev
Downloads759 total (42 in last 30 days)
StatusDocs uploaded by user
Build status unknown [no reports yet]




Maintainers' corner

For package maintainers and hackage trustees