reflex-0.8.2.2: Higher-order Functional Reactive Programming

Safe HaskellNone
LanguageHaskell2010

Reflex.Query.Class

Description

 
Synopsis

Documentation

class (Monoid (QueryResult a), Semigroup (QueryResult a)) => Query a where Source #

A Query can be thought of as a declaration of interest in some set of data. A QueryResult is the set of data associated with that interest set. The crop function provides a way to determine what part of a given QueryResult is relevant to a given Query.

Associated Types

type QueryResult a :: Type Source #

Methods

crop :: a -> QueryResult a -> QueryResult a Source #

Instances
Query () Source #

Trivial queries have trivial results.

Instance details

Defined in Reflex.Query.Class

Associated Types

type QueryResult () :: Type Source #

Methods

crop :: () -> QueryResult () -> QueryResult () Source #

Query Void Source #

The result of an absurd query is trivial; If you can ask the question, the answer cannot tell you anything you didn't already know.

'QueryResult Void = Void' seems like it would also work, but that has problems of robustness. In some applications, an unasked question can still be answered, so it is important that the result is inhabited even when the question isn't. Applications that wish to prevent this can mandate that the query result be paired with the query: then the whole response will be uninhabited as desired.

Instance details

Defined in Reflex.Query.Class

Associated Types

type QueryResult Void :: Type Source #

(Query a, Query b) => Query (a, b) Source #

the result of two queries is both results.

Instance details

Defined in Reflex.Query.Class

Associated Types

type QueryResult (a, b) :: Type Source #

Methods

crop :: (a, b) -> QueryResult (a, b) -> QueryResult (a, b) Source #

(Ord k, Query v) => Query (MonoidalMap k v) Source # 
Instance details

Defined in Reflex.Query.Class

Associated Types

type QueryResult (MonoidalMap k v) :: Type Source #

(Query q, Applicative f) => Query (Ap f q) Source #

We can lift queries into monoidal containers. But beware of Applicatives whose monoid is different from (pure mempty, liftA2 mappend)

Instance details

Defined in Reflex.Query.Class

Associated Types

type QueryResult (Ap f q) :: Type Source #

Methods

crop :: Ap f q -> QueryResult (Ap f q) -> QueryResult (Ap f q) Source #

data QueryMorphism q q' Source #

QueryMorphism's must be group homomorphisms when acting on the query type and compatible with the query relationship when acting on the query result.

Instances
Category QueryMorphism Source # 
Instance details

Defined in Reflex.Query.Class

Methods

id :: QueryMorphism a a #

(.) :: QueryMorphism b c -> QueryMorphism a b -> QueryMorphism a c #

newtype SelectedCount Source #

This type can be used to track of the frequency of interest in a given Query. See note on combineSelectedCounts

Constructors

SelectedCount 

Fields

Instances
Bounded SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Enum SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Eq SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Integral SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Data SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SelectedCount -> c SelectedCount #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SelectedCount #

toConstr :: SelectedCount -> Constr #

dataTypeOf :: SelectedCount -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SelectedCount) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SelectedCount) #

gmapT :: (forall b. Data b => b -> b) -> SelectedCount -> SelectedCount #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SelectedCount -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SelectedCount -> r #

gmapQ :: (forall d. Data d => d -> u) -> SelectedCount -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SelectedCount -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SelectedCount -> m SelectedCount #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectedCount -> m SelectedCount #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectedCount -> m SelectedCount #

Num SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Ord SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Read SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Real SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Show SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Ix SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Semigroup SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Monoid SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Storable SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Bits SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

FiniteBits SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Commutative SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

Group SelectedCount Source # 
Instance details

Defined in Reflex.Query.Class

combineSelectedCounts :: SelectedCount -> SelectedCount -> Maybe SelectedCount Source #

The Semigroup/Monoid/Group instances for a Query containing SelectedCounts should use this function which returns Nothing if the result is 0. This allows the pruning of leaves of the Query that are no longer wanted.

class (Group q, Commutative q, Query q, Monad m) => MonadQuery t q m | m -> q t where Source #

A class that allows sending of Querys and retrieval of QueryResults. See queryDyn for a commonly used interface.

Instances
MonadQuery t q m => MonadQuery t q (ReaderT r m) Source # 
Instance details

Defined in Reflex.Query.Class

(MonadQuery t q m, Monad m) => MonadQuery t q (EventWriterT t w m) Source # 
Instance details

Defined in Reflex.EventWriter.Base

(Monad m, Group q, Commutative q, Query q, Reflex t) => MonadQuery t q (QueryT t q m) Source # 
Instance details

Defined in Reflex.Query.Base

(MonadQuery t q m, Monad m) => MonadQuery t q (DynamicWriterT t w m) Source # 
Instance details

Defined in Reflex.DynamicWriter.Base

(MonadQuery t q m, Monad m) => MonadQuery t q (BehaviorWriterT t w m) Source # 
Instance details

Defined in Reflex.BehaviorWriter.Base

MonadQuery t q m => MonadQuery (ProfiledTimeline t) q (ProfiledM m) Source # 
Instance details

Defined in Reflex.Profiled

tellQueryDyn :: (Reflex t, MonadQuery t q m) => Dynamic t q -> m () Source #

Produce and send an Incremental Query from a Dynamic Query.

queryDyn :: (Reflex t, MonadQuery t q m) => Dynamic t q -> m (Dynamic t (QueryResult q)) Source #

Retrieve Dynamically updating QueryResults for a Dynamically updating Query.

subQuery :: (Reflex t, MonadQuery t q2 m) => QueryMorphism q1 q2 -> Dynamic t q1 -> m (Dynamic t (QueryResult q1)) Source #

Use a query morphism to operate on a smaller version of a query.

mapQuery :: QueryMorphism q q' -> q -> q' Source #

Apply a QueryMorphism to a Query