bitwise-enum-1.0.1.0: Bitwise operations on bounded enumerations

Data.Enum.Memo

Contents

Description

Immutable lazy tables of functions over bounded enumerations. Function calls are stored as thunks and not evaluated until accessed.

The underlying representation is an Array rather than a search tree. This provides O(1) lookup but means that the range of keys should not be very large, as in the case of an Int-like type.

Synopsis

# Memoization

memoize :: forall k v. (Bounded k, Enum k) => (k -> v) -> k -> v Source #

Memoize a function with a single argument.

# Higher-order

memoize2 :: forall k1 k2 v. (Bounded k1, Enum k1, Bounded k2, Enum k2) => (k1 -> k2 -> v) -> k1 -> k2 -> v Source #

Memoize a function with two arguments.

memoize3 :: forall k1 k2 k3 v. (Bounded k1, Enum k1, Bounded k2, Enum k2, Bounded k3, Enum k3) => (k1 -> k2 -> k3 -> v) -> k1 -> k2 -> k3 -> v Source #

Memoize a function with three arguments.

memoize4 :: forall k1 k2 k3 k4 v. (Bounded k1, Enum k1, Bounded k2, Enum k2, Bounded k3, Enum k3, Bounded k4, Enum k4) => (k1 -> k2 -> k3 -> k4 -> v) -> k1 -> k2 -> k3 -> k4 -> v Source #

Memoize a function with four arguments.

memoize5 :: forall k1 k2 k3 k4 k5 v. (Bounded k1, Enum k1, Bounded k2, Enum k2, Bounded k3, Enum k3, Bounded k4, Enum k4, Bounded k5, Enum k5) => (k1 -> k2 -> k3 -> k4 -> k5 -> v) -> k1 -> k2 -> k3 -> k4 -> k5 -> v Source #

Memoize a function with five arguments.