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


Properties

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)
LicenseBSD3
AuthorEduard Sergeev
Maintainereduard.sergeev@gmail.com
CategoryControl, Monad
Home pagehttps://github.com/EduardSergeev/monad-memo
Source repositoryhead: git clone https://github.com/EduardSergeev/monad-memo.git
this: git clone https://github.com/EduardSergeev/monad-memo.git(tag 0.4.1)
Upload dateWed Mar 6 05:25:47 UTC 2013
Uploaded byEduardSergeev
Downloads438 total (35 in last 30 days)

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees