ouroboros-network-framework-0.6.0.1: 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 Source #

(<$) ∷ a → Cache b → Cache a Source #

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

Defined in Data.Cache

Methods

memptyCache a Source #

mappendCache a → Cache a → Cache a Source #

mconcat ∷ [Cache a] → Cache a Source #

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

Defined in Data.Cache

Methods

(<>)Cache a → Cache a → Cache a Source #

sconcatNonEmpty (Cache a) → Cache a Source #

stimesIntegral b ⇒ b → Cache a → Cache a Source #

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

Defined in Data.Cache

Methods

showsPrecIntCache a → ShowS Source #

showCache a → String Source #

showList ∷ [Cache a] → ShowS Source #

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

Defined in Data.Cache

Methods

(==)Cache a → Cache a → Bool Source #

(/=)Cache a → Cache a → Bool Source #

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.