data-memocombinators 0.4.4 → 0.4.5
raw patch · 2 files changed
+9/−5 lines, 2 files
Files
Data/MemoCombinators.hs view
@@ -26,12 +26,12 @@ -- > fib' x = fib (x-1) + fib (x-2) ------------------------------------------------ -module Data.MemoCombinators +module Data.MemoCombinators ( Memo , wrap , memo2, memo3, memoSecond, memoThird , bool, char, list, boundedList, either, maybe, unit, pair- , integral, bits+ , enum, integral, bits , switch , RangeMemo , arrayRange, unsafeArrayRange, chunks@@ -48,7 +48,7 @@ type Memo a = forall r. (a -> r) -> (a -> r) -- | Given a memoizer for a and an isomorphism between a and b, build--- a memoizer for b. +-- a memoizer for b. wrap :: (a -> b) -> (b -> a) -> Memo a -> Memo b wrap i j m f = m (f . i) . j @@ -110,7 +110,11 @@ pair :: Memo a -> Memo b -> Memo (a,b) pair m m' f = uncurry (m (\x -> m' (\y -> f (x,y)))) --- | Memoize an integral type. +-- | Memoize an enum type.+enum :: (Enum a) => Memo a+enum = wrap toEnum fromEnum integral++-- | Memoize an integral type. integral :: (Integral a) => Memo a integral = wrap fromInteger toInteger bits
data-memocombinators.cabal view
@@ -1,7 +1,7 @@ Name: data-memocombinators Description: Combinators for building memo tables.-Version: 0.4.4+Version: 0.4.5 Stability: experimental Synopsis: Combinators for building memo tables. License: BSD3