hlrdb-core-0.1.0.0: High-level Redis Database Core API

Safe HaskellSafe
LanguageHaskell2010

HLRDB.Primitives.Aggregate

Description

Combinators that can be used for aggregating independent queries. See my article about aggregating mget queries for more information.

Synopsis

Documentation

newtype T x y a b Source #

Abstract representation for aggregation.

Constructors

T (Traversal a b x y) 

Instances

Profunctor (T x y) Source # 

Methods

dimap :: (a -> b) -> (c -> d) -> T x y b c -> T x y a d #

lmap :: (a -> b) -> T x y b c -> T x y a c #

rmap :: (b -> c) -> T x y a b -> T x y a c #

(#.) :: Coercible * c b => (b -> c) -> T x y a b -> T x y a c #

(.#) :: Coercible * b a => T x y b c -> (a -> b) -> T x y a c #

Choice (T x y) Source # 

Methods

left' :: T x y a b -> T x y (Either a c) (Either b c) #

right' :: T x y a b -> T x y (Either c a) (Either c b) #

Traversing (T x y) Source # 

Methods

traverse' :: Traversable f => T x y a b -> T x y (f a) (f b) #

wander :: (forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t) -> T x y a b -> T x y s t #

Strong (T x y) Source # 

Methods

first' :: T x y a b -> T x y (a, c) (b, c) #

second' :: T x y a b -> T x y (c, a) (c, b) #

Functor (T x y a) Source # 

Methods

fmap :: (a -> b) -> T x y a a -> T x y a b #

(<$) :: a -> T x y a b -> T x y a a #

Applicative (T x y a) Source # 

Methods

pure :: a -> T x y a a #

(<*>) :: T x y a (a -> b) -> T x y a a -> T x y a b #

liftA2 :: (a -> b -> c) -> T x y a a -> T x y a b -> T x y a c #

(*>) :: T x y a a -> T x y a b -> T x y a b #

(<*) :: T x y a a -> T x y a b -> T x y a a #

type (⟿) a b = T ByteString (Maybe ByteString) a b Source #

A query using input of type a and yielding an output of type b

type Query a b = a b Source #

Non-infix alias of ⟿

aggregatePair :: T x y a b -> T x y c d -> T x y (a, c) (b, d) Source #

We can merge any two arbitrary mget queries.

remember :: T x y a b -> T x y a (a, b) Source #

And we can remember the lookup

runT :: Functor f => ([x] -> f [y]) -> T x y a b -> a -> f b Source #

Reify aggregation into a target functor.