cached-traversable-0.1.0.1: Transparent, persistent caching of lazy, traversable structures

Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Traversable.Cached

Synopsis

Documentation

cached :: (Binary a, Traversable t) => FilePath -> t a -> IO (t a) Source

Traverse the given structure, retrieving values from and storing values in the cache at the given path. Only the element type need be serializable. The struture must be lazy in the values for this to be effective. This does not work well for large structures because the entire cache is rewritten every time a new value is computed. Works best when values are small, but expensive to compute. Atomicity and consistency are weakly guaranteed by writing the cache to a new file every time, and renaming the file into place.