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

Hasura.GraphQL.Schema.Parser

Description

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

Documentation

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.

memoizeOn Source #

Arguments

:: (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 Name as a convenient source for a static, unique identifier.

-> 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. p is intended to be either 'Parser k' or FieldParser.

-> m (p n b) 

memoize Source #

Arguments

:: (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. p is intended to be either 'Parser k' or FieldParser.

-> a -> m (p n b) 

A wrapper around memoizeOn that memoizes a function by using its argument as the key.