napkin-0.5.9
Safe HaskellNone
LanguageHaskell2010

Polysemy.Memoize.Example

Description

An experimental idea to see if we can whole-sale cache the results of certain effect computations, when we can be confident that their repeated invocation should result in the same outcome. The idea is that a first interpretation of the effect stack (e.g. during a validation or dry run) can produce this memoization cache and repeated interpretations of the same effect during the same program session can just lookup results from th cache.

A good example is parsing of SQL files from disk. We'd want to do it once and have much faster resolution on repeat runs.

Documentation

data Example m a where #

Constructors

NextInt :: Example m Int 

Instances

Instances details
CachableEffect (Example :: k -> Type -> Type) ExampleCachableEffect # 
Instance details

Defined in Polysemy.Memoize.Example

Eq (Example m a) # 
Instance details

Defined in Polysemy.Memoize.Example

Methods

(==) :: Example m a -> Example m a -> Bool #

(/=) :: Example m a -> Example m a -> Bool #

Ord (Example m a) # 
Instance details

Defined in Polysemy.Memoize.Example

Methods

compare :: Example m a -> Example m a -> Ordering #

(<) :: Example m a -> Example m a -> Bool #

(<=) :: Example m a -> Example m a -> Bool #

(>) :: Example m a -> Example m a -> Bool #

(>=) :: Example m a -> Example m a -> Bool #

max :: Example m a -> Example m a -> Example m a #

min :: Example m a -> Example m a -> Example m a #

nextInt :: forall r. MemberWithError Example r => Sem r Int #

runExample :: Sem (Example ': r) a -> Sem r a #

data ExampleCachableEffect #

Instances

Instances details
CachableEffect (Example :: k -> Type -> Type) ExampleCachableEffect # 
Instance details

Defined in Polysemy.Memoize.Example

cacheInput :: forall e r m a ce. (Eq (e m a), Ord (e m a), Member e r, Member (AtomicState (ResultCache ce)) r, e ~ Example, Member e ce) => Sem r a -> Sem r a #

example :: ([Int], ()) #