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

Hasura.Incremental.Select

Synopsis

Documentation

class GCompare (Selector a) => Select a where Source #

The Select class provides a way to access subparts of a product type using a reified Selector. A Selector a b is essentially a function from a to b, and indeed select converts a Selector to such a function. However, unlike functions, Selectors can be compared for equality using GEq and ordered using GCompare.

This is useful to implement dependency tracking, since it’s possible to track in a reified form exactly which parts of a data structure are used.

Instances of Select can be automatically derived for record types (just define an empty instance). The instance uses the magical HasField constraints, and Selectors for the type can be written using OverloadedLabels.

Minimal complete definition

Nothing

Associated Types

type Selector a :: Type -> Type Source #

type Selector r = FieldS r

Methods

select :: Selector a b -> a -> b Source #

default select :: Selector a ~ FieldS a => Selector a b -> a -> b Source #

Instances

Instances details
Select InvalidationKeys Source # 
Instance details

Defined in Hasura.RQL.DDL.Schema.Cache.Common

Associated Types

type Selector InvalidationKeys :: Type -> Type Source #

(Eq k, Ord k, Hashable k) => Select (HashMap k v) Source # 
Instance details

Defined in Hasura.Incremental.Select

Associated Types

type Selector (HashMap k v) :: Type -> Type Source #

Methods

select :: Selector (HashMap k v) b -> HashMap k v -> b Source #

GCompare k => Select (DMap k f) Source # 
Instance details

Defined in Hasura.Incremental.Select

Associated Types

type Selector (DMap k f) :: Type -> Type Source #

Methods

select :: Selector (DMap k f) b -> DMap k f -> b Source #

data ConstS k a b where Source #

The constant selector, which is useful for representing selectors into data structures where all fields have the same type. Matching on a value of type ConstS k a b causes a and b to unify, effectively “pinning” b to a.

Constructors

ConstS :: !k -> ConstS k a a 

Instances

Instances details
Eq k => GEq (ConstS k a :: Type -> Type) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

geq :: forall (a0 :: k0) (b :: k0). ConstS k a a0 -> ConstS k a b -> Maybe (a0 :~: b)

Ord k => GCompare (ConstS k a :: Type -> Type) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

gcompare :: forall (a0 :: k0) (b :: k0). ConstS k a a0 -> ConstS k a b -> GOrdering a0 b

selectKey :: (Select a, Selector a ~ ConstS k v) => k -> a -> v Source #

data FieldS r a where Source #

Constructors

FieldS :: (KnownSymbol s, HasField s r a) => !(Proxy s) -> FieldS r a 

Instances

Instances details
(KnownSymbol s, HasField s r a) => IsLabel s (FieldS r a) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

fromLabel :: FieldS r a #

GEq (FieldS r :: Type -> Type) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

geq :: forall (a :: k) (b :: k). FieldS r a -> FieldS r b -> Maybe (a :~: b)

GCompare (FieldS r :: Type -> Type) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

gcompare :: forall (a :: k) (b :: k). FieldS r a -> FieldS r b -> GOrdering a b

newtype UniqueS a Source #

A UniqueS is, as the name implies, a globally-unique Selector, which can be created using newUniqueS. If a value of type UniqueS a is found to be equal (via geq) with another value of type UniqueS b, then a and b must be the same type. This effectively allows the creation of a dynamically-extensible sum type, where new constructors can be created at runtime using newUniqueS.

Constructors

UniqueS Unique 

Instances

Instances details
Eq (UniqueS a) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

(==) :: UniqueS a -> UniqueS a -> Bool #

(/=) :: UniqueS a -> UniqueS a -> Bool #

GEq UniqueS Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

geq :: forall (a :: k) (b :: k). UniqueS a -> UniqueS b -> Maybe (a :~: b)

GCompare UniqueS Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

gcompare :: forall (a :: k) (b :: k). UniqueS a -> UniqueS b -> GOrdering a b

data DMapS k f a where Source #

Constructors

DMapS :: !(k a) -> DMapS k f (Maybe (f a)) 

Instances

Instances details
GEq k => GEq (DMapS k f :: Type -> Type) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

geq :: forall (a :: k0) (b :: k0). DMapS k f a -> DMapS k f b -> Maybe (a :~: b)

GCompare k => GCompare (DMapS k f :: Type -> Type) Source # 
Instance details

Defined in Hasura.Incremental.Select

Methods

gcompare :: forall (a :: k0) (b :: k0). DMapS k f a -> DMapS k f b -> GOrdering a b