Memoization combinators using arrays for finite sub-domains of functions

LTS Haskell 17.10:0.6.0
Stackage Nightly 2021-05-09:0.6.0
Latest on Hackage:0.6.0

See all snapshots array-memoize appears in

BSD-3-Clause licensed and maintained by Dominic Orchard
This version can be pinned in stack with:array-memoize-0.6.0@sha256:2dc57f15e55ff320494704733bef5792c2404e9ad8bd5f0d3119abb9d36a31f6,1534

Module documentation for 0.6.0

Depends on 2 packages(full list with versions):

Memoization combinators are great for providing high-performance Haskell programs, but they can be even faster if memoization is performed on a finite, discrete domain since an array can then be used to store results.

This package provides various combinators for doing just this, including also combinators for quanitzing and discretizing Float/Double-valued functions.


fib' :: (Int -> Int) -> Int -> Int
fib' _ 0 = 1
fib' _ 1 = 1
fib' rec n = rec (n - 1) + rec (n - 2)
fib :: Int -> Int
fib = arrayMemoFix (0, 1000) fib'