Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
newtype
Cache
a =
Cache
{
- getCache :: a
- withCacheA :: ( Applicative m, Eq a) => Cache a -> a -> (a -> m ()) -> m ()
- traceWithCache :: ( Applicative m, Eq a) => Tracer m a -> Cache a -> a -> m ()
- mapTraceWithCache :: ( Applicative m, Eq a) => (a -> b) -> Tracer m b -> Cache a -> a -> m ()
Documentation
Cache newtype wrapper allows to perform an action only if the cache is not up-to-date, i.e. different than another value dimmed more recent.
withCacheA :: ( Applicative m, Eq a) => Cache a -> a -> (a -> m ()) -> m () Source #
Run a computation that depends on a certain cached value, only if the the most recent one is different.
traceWithCache :: ( Applicative m, Eq a) => Tracer m a -> Cache a -> a -> m () Source #
Trace with cache only performs the tracing when the cached value is different than the most recent one.
mapTraceWithCache :: ( Applicative m, Eq a) => (a -> b) -> Tracer m b -> Cache a -> a -> m () Source #
Trace with cache only performs the tracing when the cached value is different than the most recent one. And applies a function to the cache value before tracing.