graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.Incremental.Internal.Cache

Synopsis

Documentation

class ArrowKleisli m arr => ArrowCache m arr | arr -> m where Source #

Methods

cache :: Cacheable a => arr a b -> arr a b Source #

Adds equality-based caching to the given arrow. After each execution of the arrow, its input and result values are cached. On the next execution, the new input value is compared via == to the previous input value. If they are the same, the previous result is returned without re-executing the arrow. Otherwise, the old cached values are discarded, and the arrow is re-executed to produce a new set of cached values.

Indescriminate use of cache is likely to have little effect except to increase memory usage, since the input and result of each execution must be retained in memory. Avoid using cache around arrows with large input or output that is likely to change often unless profiling indicates it is computationally expensive enough to be worth the memory overhead.

Note that only direct inputs and outputs of the given arrow are cached. If an arrow provides access to values through a side-channel, they will not participate in caching.

newDependency :: arr a (Dependency a) Source #

Creates a new Dependency, which allows fine-grained caching of composite values; see the documentation for Dependency for more details.

dependOn :: Cacheable a => arr (Dependency a) a Source #

Extract the value from a Dependency, incurring a dependency on its entirety. To depend on only a portion of the value, use selectD or selectKeyD before passing it to dependOn.

bindDepend :: arr (DependT m a) a Source #

Run a monadic sub-computation with the ability to access dependencies; see MonadDepend for more details.

Instances

Instances details
MonadUnique m => ArrowCache m (Rule m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

cache :: Cacheable a => Rule m a b -> Rule m a b Source #

newDependency :: Rule m a (Dependency a) Source #

dependOn :: Cacheable a => Rule m (Dependency a) a Source #

bindDepend :: Rule m (DependT m a) a Source #

(Monoid w, ArrowCache m arr) => ArrowCache m (WriterA w arr) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

cache :: Cacheable a => WriterA w arr a b -> WriterA w arr a b Source #

newDependency :: WriterA w arr a (Dependency a) Source #

dependOn :: Cacheable a => WriterA w arr (Dependency a) a Source #

bindDepend :: WriterA w arr (DependT m a) a Source #

(ArrowChoice arr, ArrowCache m arr) => ArrowCache m (ErrorA e arr) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

cache :: Cacheable a => ErrorA e arr a b -> ErrorA e arr a b Source #

newDependency :: ErrorA e arr a (Dependency a) Source #

dependOn :: Cacheable a => ErrorA e arr (Dependency a) a Source #

bindDepend :: ErrorA e arr (DependT m a) a Source #

class Monad m => MonadDepend m where Source #

A restricted, monadic variant of ArrowCache that can only read dependencies, not create new ones or add local caching. This serves as a limited adapter between arrow and monadic code.

Methods

dependOnM :: Cacheable a => Dependency a -> m a Source #

Instances

Instances details
Monad m => MonadDepend (DependT m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

dependOnM :: Cacheable a => Dependency a -> DependT m a Source #

MonadDepend m => MonadDepend (ExceptT e m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

dependOnM :: Cacheable a => Dependency a -> ExceptT e m a Source #

newtype DependT m a Source #

Constructors

DependT 

Fields

Instances

Instances details
MonadTrans DependT Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

lift :: Monad m => m a -> DependT m a #

MonadError e m => MonadError e (DependT m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

throwError :: e -> DependT m a #

catchError :: DependT m a -> (e -> DependT m a) -> DependT m a #

Monad m => Monad (DependT m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

(>>=) :: DependT m a -> (a -> DependT m b) -> DependT m b #

(>>) :: DependT m a -> DependT m b -> DependT m b #

return :: a -> DependT m a #

Functor m => Functor (DependT m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

fmap :: (a -> b) -> DependT m a -> DependT m b #

(<$) :: a -> DependT m b -> DependT m a #

Monad m => Applicative (DependT m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

pure :: a -> DependT m a #

(<*>) :: DependT m (a -> b) -> DependT m a -> DependT m b #

liftA2 :: (a -> b -> c) -> DependT m a -> DependT m b -> DependT m c #

(*>) :: DependT m a -> DependT m b -> DependT m b #

(<*) :: DependT m a -> DependT m b -> DependT m a #

Monad m => MonadDepend (DependT m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Cache

Methods

dependOnM :: Cacheable a => Dependency a -> DependT m a Source #