Safe Haskell | None |
---|---|
Language | Haskell2010 |
In Parser
, the Definition
type has a dOrigin
field
that allows to track where a fragment of GraphQL type information comes from.
This is useful for error reporting and internal repair mechanisms such as
inconsistency tracking.
Morally, within the HGE codebase, this origin is always MetadataObjId
.
However, in order to avoid an import of RQL
from
Parser
, the dOrigin
has been defined through a type
parameter of Definition
. This type parameter then has to get threaded
through throughout the Parser
module hierarchy, so that it
ends up in a lot of types. This is very noisy.
In order to avoid the noise of this type parameter, which really only has one
value, and is really only used in one type, this module erases the type
parameter by filling in the desired value, exporting type synonyms of the
now-fixed notion of "origin". So most modules in the HGE codebase should
import this module rather than Parser
.
Synopsis
- type FieldParser = FieldParser MetadataObjId
- type Parser = Parser MetadataObjId
- type Schema = Schema MetadataObjId
- type ConflictingDefinitions = ConflictingDefinitions MetadataObjId
- type Type = Type MetadataObjId
- type InputFieldsParser = InputFieldsParser MetadataObjId
- type Definition = Definition MetadataObjId
- type Directive = Directive MetadataObjId
- type DirectiveInfo = DirectiveInfo MetadataObjId
- type FieldInfo = FieldInfo MetadataObjId
- type InputFieldInfo = InputFieldInfo MetadataObjId
- type HasTypeDefinitions = HasTypeDefinitions MetadataObjId
- type SomeDefinitionTypeInfo = SomeDefinitionTypeInfo MetadataObjId
- type TypeDefinitionsWrapper = TypeDefinitionsWrapper MetadataObjId
- pattern TypeDefinitionsWrapper :: () => forall a. HasTypeDefinitions a => a -> TypeDefinitionsWrapper
- toQErr :: MonadError QErr m => Either ParseError a -> m a
- memoizeOn :: (MonadMemoize m, Ord a, Typeable a, Typeable p, MonadParse n, Typeable b) => Name -> a -> m (p n b) -> m (p n b)
- memoize :: (MonadMemoize m, Ord a, Typeable a, Typeable p, MonadParse n, Typeable b) => Name -> (a -> m (p n b)) -> a -> m (p n b)
Documentation
type FieldParser = FieldParser MetadataObjId Source #
type Parser = Parser MetadataObjId Source #
type Schema = Schema MetadataObjId Source #
type Type = Type MetadataObjId Source #
type Definition = Definition MetadataObjId Source #
type Directive = Directive MetadataObjId Source #
type FieldInfo = FieldInfo MetadataObjId Source #
pattern TypeDefinitionsWrapper :: () => forall a. HasTypeDefinitions a => a -> TypeDefinitionsWrapper Source #
In order to aid type inference and type checking, we define this pattern
synonym (an actual one) which restricts TypeDefinitionsWrapper
to have
MetadataObjId
set for its origin type parameter.
toQErr :: MonadError QErr m => Either ParseError a -> m a Source #
:: (MonadMemoize m, Ord a, Typeable a, Typeable p, MonadParse n, Typeable b) | |
=> Name | A unique name used to identify the function being memoized. There isn’t
really any metaprogramming going on here, we just use a Template Haskell
|
-> a | The value to use as the memoization key. It’s the caller’s responsibility to ensure multiple calls to the same function don’t use the same key. |
-> m (p n b) | The value to be memoized. |
-> m (p n b) |
:: (MonadMemoize m, Ord a, Typeable a, Typeable p, MonadParse n, Typeable b) | |
=> Name | |
-> (a -> m (p n b)) | A function generating something to be memoized. |
-> a -> m (p n b) |
A wrapper around memoizeOn
that memoizes a function by using its argument
as the key.