yamemo-0.6.0: Simple memoisation function

Safe HaskellSafe-Inferred

Data.Function.YaMemo

Contents

Description

Memoisation. It's useful for dynamic programming.

Synopsis

Module

Type

type Memo t a b = a -> State (t a b) bSource

Function

memo :: (MemoTable t, Ord a) => (a -> State (t a b) b) -> ((a -> State (t a b) b) -> Memo t a b) -> a -> bSource

makes memo function from functional specified by the second argument. The first argument is only for imforming type of memo table will be used.

memo' :: (MemoTable t, Ord a) => ((a -> State (t a b) b) -> Memo t a b) -> t a b -> a -> (t a b, b)Source

makes memo function which also takes and returns memo table , which can be reused.