Portability | presumably portable |
---|---|
Stability | experimental |
Maintainer | Luke Palmer <lrpalmer@gmail.com> |
This module provides combinators for building memo tables over various data types, so that the type of table can be customized depending on the application.
- type Memo a = forall r. (a -> r) -> a -> r
- memo2 :: Memo a -> Memo b -> (a -> b -> r) -> a -> b -> r
- memo3 :: Memo a -> Memo b -> Memo c -> (a -> b -> c -> r) -> a -> b -> c -> r
- memoSecond :: Memo b -> (a -> b -> r) -> a -> b -> r
- memoThird :: Memo c -> (a -> b -> c -> r) -> a -> b -> c -> r
- bool :: Memo Bool
- type RangeMemo a = a -> a -> Memo a
- arrayRange :: Ix a => RangeMemo a
- chunks :: Ix a => RangeMemo a -> [(a, a)] -> Memo a
Documentation
memo2 :: Memo a -> Memo b -> (a -> b -> r) -> a -> b -> rSource
Memoize a two argument function (just apply the table directly for single argument functions).
memo3 :: Memo a -> Memo b -> Memo c -> (a -> b -> c -> r) -> a -> b -> c -> rSource
Memoize a three argument function.
memoSecond :: Memo b -> (a -> b -> r) -> a -> b -> rSource
Memoize the second argument of a function.
memoThird :: Memo c -> (a -> b -> c -> r) -> a -> b -> c -> rSource
Memoize the third argument of a function.
type RangeMemo a = a -> a -> Memo aSource
The type of builders for ranged tables; takes a lower bound and an upper bound, and returns a memo table for that range. The table's behavior is undefined for values outside that range.
arrayRange :: Ix a => RangeMemo aSource
Build a memo table for a range using a flat array.