ouroboros-network-framework-0.13.1.0: Ouroboros network framework
Safe HaskellSafe-Inferred
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

memptyCache a #

mappendCache 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 #

sconcatNonEmpty (Cache a) → Cache a #

stimesIntegral b ⇒ b → Cache a → Cache a #

Show a ⇒ Show (Cache a) Source # 
Instance details

Defined in Data.Cache

Methods

showsPrecIntCache a → ShowS #

showCache 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.