- Breaking Caching functions previously returned
m (t a)
, but it was easy to accidentally usejoin
whenm
andt
were the same monad (eg.IO (IO a)
), and not get any caching at all. These functions now use aCached
newtype fort a
to make it more difficult to misuse.
-- Previous versions
f :: IO ()
f = do
cachedAction <- cachedIO action :: IO (IO a)
cachedResult <- cachedAction
-- New version
f :: IO ()
f = do
cachedAction <- cachedIO action :: IO (Cached IO a)
cachedResult <- runCached cachedAction
Thank you glasserc for your work on previous versions, and a special thanks to Arguggi for contributing many of the improvements incorporated into this version.
- Bellroy is the new maintainer of this package. See glasserc#1.
- New
cachedIO'
andcachedIOWith'
support generating an action depending on the most recent cached value and its timestamp, if there was one. cachedIO ttl f
can now be run in a different monad tof
. Similarly forcachedIO'
,cachedIOWith
,cachedIOWith'
.- Fixes uncaught exceptions leaving the cache in a deadlocked state and other problems.
These versions were published by glasserc.