| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hasura.Incremental.Select
Synopsis
- class GCompare (Selector a) => Select a where
- data ConstS k a b where
- selectKey :: (Select a, Selector a ~ ConstS k v) => k -> a -> v
- data FieldS r a where
- FieldS :: (KnownSymbol s, HasField s r a) => !(Proxy s) -> FieldS r a
- newtype UniqueS a = UniqueS Unique
- newUniqueS :: MonadUnique m => m (UniqueS a)
- data DMapS k f a where
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 is essentially a function from Selector a ba 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
Methods
Instances
| Select InvalidationKeys Source # | |
Defined in Hasura.RQL.DDL.Schema.Cache.Common Methods select :: Selector InvalidationKeys b -> InvalidationKeys -> b Source # | |
| (Eq k, Ord k, Hashable k) => Select (HashMap k v) Source # | |
| GCompare k => Select (DMap k f) 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 causes ConstS k a ba and b to
unify, effectively “pinning” b to a.
data FieldS r a where Source #
Constructors
| FieldS :: (KnownSymbol s, HasField s r a) => !(Proxy s) -> FieldS r a |
A UniqueS is, as the name implies, a globally-unique Selector, which can be created using
newUniqueS. If a value of type is found to be equal (via UniqueS ageq) with another
value of type , then UniqueS ba 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.
newUniqueS :: MonadUnique m => m (UniqueS a) Source #