ouroboros-network-framework
Safe HaskellNone
LanguageHaskell2010

Data.Cache

Synopsis

Documentation

newtype Cache a Source #

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.

Constructors

Cache 

Fields

Instances

Instances details
Functor Cache Source # 
Instance details

Defined in Data.Cache

Methods

fmap :: (a -> b) -> Cache a -> Cache b #

(<$) :: a -> Cache b -> Cache a #

Monoid a => Monoid (Cache a) Source # 
Instance details

Defined in Data.Cache

Methods

mempty :: Cache a #

mappend :: Cache a -> Cache a -> Cache a #

mconcat :: [Cache a] -> Cache a #

Semigroup a => Semigroup (Cache a) Source # 
Instance details

Defined in Data.Cache

Methods

(<>) :: Cache a -> Cache a -> Cache a #

sconcat :: NonEmpty (Cache a) -> Cache a #

stimes :: Integral b => b -> Cache a -> Cache a #

Show a => Show (Cache a) Source # 
Instance details

Defined in Data.Cache

Methods

showsPrec :: Int -> Cache a -> ShowS #

show :: Cache a -> String #

showList :: [Cache a] -> ShowS #

Eq a => Eq (Cache a) Source # 
Instance details

Defined in Data.Cache

Methods

(==) :: Cache a -> Cache a -> Bool #

(/=) :: Cache a -> Cache a -> Bool #

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.