-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell GraphQL implementation -- -- Haskell GraphQL implementation. @package graphql @version 1.2.0.3 -- | Various parts of a GraphQL document can be annotated with directives. -- This module describes locations in a document where directives can -- appear. module Language.GraphQL.AST.DirectiveLocation -- | All directives can be splitted in two groups: directives used to -- annotate various parts of executable definitions and the ones used in -- the schema definition. data DirectiveLocation ExecutableDirectiveLocation :: ExecutableDirectiveLocation -> DirectiveLocation TypeSystemDirectiveLocation :: TypeSystemDirectiveLocation -> DirectiveLocation -- | Where directives can appear in an executable definition, like a query. data ExecutableDirectiveLocation Query :: ExecutableDirectiveLocation Mutation :: ExecutableDirectiveLocation Subscription :: ExecutableDirectiveLocation Field :: ExecutableDirectiveLocation FragmentDefinition :: ExecutableDirectiveLocation FragmentSpread :: ExecutableDirectiveLocation InlineFragment :: ExecutableDirectiveLocation -- | Where directives can appear in a type system definition. data TypeSystemDirectiveLocation Schema :: TypeSystemDirectiveLocation Scalar :: TypeSystemDirectiveLocation Object :: TypeSystemDirectiveLocation FieldDefinition :: TypeSystemDirectiveLocation ArgumentDefinition :: TypeSystemDirectiveLocation Interface :: TypeSystemDirectiveLocation Union :: TypeSystemDirectiveLocation Enum :: TypeSystemDirectiveLocation EnumValue :: TypeSystemDirectiveLocation InputObject :: TypeSystemDirectiveLocation InputFieldDefinition :: TypeSystemDirectiveLocation instance GHC.Classes.Eq Language.GraphQL.AST.DirectiveLocation.ExecutableDirectiveLocation instance GHC.Classes.Eq Language.GraphQL.AST.DirectiveLocation.TypeSystemDirectiveLocation instance GHC.Classes.Eq Language.GraphQL.AST.DirectiveLocation.DirectiveLocation instance GHC.Show.Show Language.GraphQL.AST.DirectiveLocation.DirectiveLocation instance GHC.Show.Show Language.GraphQL.AST.DirectiveLocation.TypeSystemDirectiveLocation instance GHC.Show.Show Language.GraphQL.AST.DirectiveLocation.ExecutableDirectiveLocation -- | This module defines an abstract syntax tree for the GraphQL -- language. It follows closely the structure given in the specification. -- Please refer to Facebook's GraphQL Specification. for more -- information. module Language.GraphQL.AST.Document -- | Single argument. -- --
-- {
-- user(id: 4) {
-- name
-- }
-- }
--
--
-- Here "id" is an argument for the field "user" and its value is 4.
data Argument
Argument :: Name -> Node Value -> Location -> Argument
-- | A list of values passed to a field.
--
--
-- type Person {
-- name: String
-- picture(width: Int, height: Int): Url
-- }
--
--
-- Person has two fields, "name" and "picture". "name" doesn't
-- have any arguments, so ArgumentsDefinition contains an empty
-- list. "picture" contains definitions for 2 arguments: "width" and
-- "height".
newtype ArgumentsDefinition
ArgumentsDefinition :: [InputValueDefinition] -> ArgumentsDefinition
-- | Constant input value.
data ConstValue
ConstInt :: Int32 -> ConstValue
ConstFloat :: Double -> ConstValue
ConstString :: Text -> ConstValue
ConstBoolean :: Bool -> ConstValue
ConstNull :: ConstValue
ConstEnum :: Name -> ConstValue
ConstList :: [Node ConstValue] -> ConstValue
ConstObject :: [ObjectField ConstValue] -> ConstValue
-- | All kinds of definitions that can occur in a GraphQL document.
data Definition
ExecutableDefinition :: ExecutableDefinition -> Definition
TypeSystemDefinition :: TypeSystemDefinition -> Location -> Definition
TypeSystemExtension :: TypeSystemExtension -> Location -> Definition
-- | GraphQL has built-in capability to document service APIs.
-- Documentation is a GraphQL string that precedes a particular
-- definition and contains Markdown. Any GraphQL definition can be
-- documented this way.
--
--
-- """
-- Supported languages.
-- """
-- enum Language {
-- English
-- EN
--
-- Russian
-- RU
-- }
--
newtype Description
Description :: Maybe Text -> Description
-- | Directive.
--
-- Directives begin with "@", can accept arguments, and can be applied to
-- the most GraphQL elements, providing additional information.
data Directive
Directive :: Name -> [Argument] -> Location -> Directive
-- | GraphQL document.
type Document = NonEmpty Definition
-- | Single value in an enum definition.
--
--
-- enum Direction {
-- NORTH
-- EAST
-- SOUTH
-- WEST
-- }
--
--
-- "NORTH, EAST, SOUTH, and WEST are value
-- definitions of an enum type definition Direction.
data EnumValueDefinition
EnumValueDefinition :: Description -> Name -> [Directive] -> EnumValueDefinition
-- | Top-level definition of a document, either an operation or a fragment.
data ExecutableDefinition
DefinitionOperation :: OperationDefinition -> ExecutableDefinition
DefinitionFragment :: FragmentDefinition -> ExecutableDefinition
-- | The only required property of a field is its name. Optionally it can
-- also have an alias, arguments, directives and a list of subfields.
--
-- In the following query "user" is a field with two subfields, "id" and
-- "name":
--
--
-- {
-- user {
-- id
-- name
-- }
-- }
--
data Field
Field :: Maybe Name -> Name -> [Argument] -> [Directive] -> SelectionSetOpt -> Location -> Field
-- | Definition of a single field in a type.
--
--
-- type Person {
-- name: String
-- picture(width: Int, height: Int): Url
-- }
--
--
-- "name" and "picture", including their arguments and types, are field
-- definitions.
data FieldDefinition
FieldDefinition :: Description -> Name -> ArgumentsDefinition -> Type -> [Directive] -> FieldDefinition
-- | Fragment definition.
data FragmentDefinition
FragmentDefinition :: Name -> TypeCondition -> [Directive] -> SelectionSet -> Location -> FragmentDefinition
-- | A fragment spread refers to a fragment defined outside the operation
-- and is expanded at the execution time.
--
--
-- {
-- user {
-- ...userFragment
-- }
-- }
--
-- fragment userFragment on UserType {
-- id
-- name
-- }
--
data FragmentSpread
FragmentSpread :: Name -> [Directive] -> Location -> FragmentSpread
-- | Defines a list of interfaces implemented by the given object type.
--
--
-- type Business implements NamedEntity & ValuedEntity {
-- name: String
-- }
--
--
-- Here the object type Business implements two interfaces:
-- NamedEntity and ValuedEntity.
newtype ImplementsInterfaces t
ImplementsInterfaces :: t NamedType -> ImplementsInterfaces t
-- | Inline fragments don't have any name and the type condition ("on
-- UserType") is optional.
--
--
-- {
-- user {
-- ... on UserType {
-- id
-- name
-- }
-- }
--
data InlineFragment
InlineFragment :: Maybe TypeCondition -> [Directive] -> SelectionSet -> Location -> InlineFragment
-- | Defines an input value.
--
--
-- input Point2D {
-- x: Float
-- y: Float
-- }
--
--
-- The input type Point2D contains two value definitions: "x" and
-- "y".
data InputValueDefinition
InputValueDefinition :: Description -> Name -> Type -> Maybe (Node ConstValue) -> [Directive] -> InputValueDefinition
-- | Error location, line and column.
data Location
Location :: Word -> Word -> Location
[$sel:line:Location] :: Location -> Word
[$sel:column:Location] :: Location -> Word
-- | Name.
type Name = Text
-- | Represents type names.
type NamedType = Name
-- | Contains some tree node with a location.
data Node a
Node :: a -> Location -> Node a
[$sel:node:Node] :: Node a -> a
[$sel:location:Node] :: Node a -> Location
-- | Helper type to represent Non-Null types and lists of such types.
data NonNullType
NonNullTypeNamed :: Name -> NonNullType
NonNullTypeList :: Type -> NonNullType
-- | Key-value pair.
--
-- A list of ObjectFields represents a GraphQL object type.
data ObjectField a
ObjectField :: Name -> Node a -> Location -> ObjectField a
[$sel:name:ObjectField] :: ObjectField a -> Name
[$sel:value:ObjectField] :: ObjectField a -> Node a
[$sel:location:ObjectField] :: ObjectField a -> Location
-- | Operation definition.
data OperationDefinition
SelectionSet :: SelectionSet -> Location -> OperationDefinition
OperationDefinition :: OperationType -> Maybe Name -> [VariableDefinition] -> [Directive] -> SelectionSet -> Location -> OperationDefinition
-- | GraphQL has 3 operation types:
--
--
-- schema {
-- query: MyQueryRootType
-- mutation: MyMutationRootType
-- }
--
data OperationTypeDefinition
OperationTypeDefinition :: OperationType -> NamedType -> OperationTypeDefinition
-- | Extension of the schema definition by further operations or
-- directives.
data SchemaExtension
SchemaOperationExtension :: [Directive] -> NonEmpty OperationTypeDefinition -> SchemaExtension
SchemaDirectivesExtension :: NonEmpty Directive -> SchemaExtension
-- | Selection is a single entry in a selection set. It can be a single
-- Field, FragmentSpread or an InlineFragment.
data Selection
FieldSelection :: Field -> Selection
FragmentSpreadSelection :: FragmentSpread -> Selection
InlineFragmentSelection :: InlineFragment -> Selection
-- | "Top-level" selection, selection on an operation or fragment.
type SelectionSet = NonEmpty Selection
-- | Field selection.
type SelectionSetOpt = [Selection]
-- | Type representation.
data Type
TypeNamed :: Name -> Type
TypeList :: Type -> Type
TypeNonNull :: NonNullType -> Type
-- | Type condition.
type TypeCondition = Name
-- | Type definitions describe various user-defined types.
data TypeDefinition
ScalarTypeDefinition :: Description -> Name -> [Directive] -> TypeDefinition
ObjectTypeDefinition :: Description -> Name -> ImplementsInterfaces [] -> [Directive] -> [FieldDefinition] -> TypeDefinition
InterfaceTypeDefinition :: Description -> Name -> [Directive] -> [FieldDefinition] -> TypeDefinition
UnionTypeDefinition :: Description -> Name -> [Directive] -> UnionMemberTypes [] -> TypeDefinition
EnumTypeDefinition :: Description -> Name -> [Directive] -> [EnumValueDefinition] -> TypeDefinition
InputObjectTypeDefinition :: Description -> Name -> [Directive] -> [InputValueDefinition] -> TypeDefinition
-- | Extensions for custom, already defined types.
data TypeExtension
ScalarTypeExtension :: Name -> NonEmpty Directive -> TypeExtension
ObjectTypeFieldsDefinitionExtension :: Name -> ImplementsInterfaces [] -> [Directive] -> NonEmpty FieldDefinition -> TypeExtension
ObjectTypeDirectivesExtension :: Name -> ImplementsInterfaces [] -> NonEmpty Directive -> TypeExtension
ObjectTypeImplementsInterfacesExtension :: Name -> ImplementsInterfaces NonEmpty -> TypeExtension
InterfaceTypeFieldsDefinitionExtension :: Name -> [Directive] -> NonEmpty FieldDefinition -> TypeExtension
InterfaceTypeDirectivesExtension :: Name -> NonEmpty Directive -> TypeExtension
UnionTypeUnionMemberTypesExtension :: Name -> [Directive] -> UnionMemberTypes NonEmpty -> TypeExtension
UnionTypeDirectivesExtension :: Name -> NonEmpty Directive -> TypeExtension
EnumTypeEnumValuesDefinitionExtension :: Name -> [Directive] -> NonEmpty EnumValueDefinition -> TypeExtension
EnumTypeDirectivesExtension :: Name -> NonEmpty Directive -> TypeExtension
InputObjectTypeInputFieldsDefinitionExtension :: Name -> [Directive] -> NonEmpty InputValueDefinition -> TypeExtension
InputObjectTypeDirectivesExtension :: Name -> NonEmpty Directive -> TypeExtension
-- | Type system can define a schema, a type or a directive.
--
--
-- schema {
-- query: Query
-- }
--
-- directive example on FIELD_DEFINITION
--
-- type Query {
-- field: String example
-- }
--
--
-- This example defines a custom directive "@example", which is applied
-- to a field definition of the type definition Query. On the top
-- the schema is defined by taking advantage of the type Query.
data TypeSystemDefinition
SchemaDefinition :: [Directive] -> NonEmpty OperationTypeDefinition -> TypeSystemDefinition
TypeDefinition :: TypeDefinition -> TypeSystemDefinition
DirectiveDefinition :: Description -> Name -> ArgumentsDefinition -> NonEmpty DirectiveLocation -> TypeSystemDefinition
-- | Extension for a type system definition. Only schema and type
-- definitions can be extended.
data TypeSystemExtension
SchemaExtension :: SchemaExtension -> TypeSystemExtension
TypeExtension :: TypeExtension -> TypeSystemExtension
-- | List of types forming a union.
--
-- -- union SearchResult = Person | Photo ---- -- Person and Photo are member types of the union -- SearchResult. newtype UnionMemberTypes t UnionMemberTypes :: t NamedType -> UnionMemberTypes t -- | Input value (literal or variable). data Value Variable :: Name -> Value Int :: Int32 -> Value Float :: Double -> Value String :: Text -> Value Boolean :: Bool -> Value Null :: Value Enum :: Name -> Value List :: [Node Value] -> Value Object :: [ObjectField Value] -> Value -- | Variable definition. -- -- Each operation can include a list of variables: -- --
-- query (protagonist: String = "Zarathustra") {
-- getAuthor(protagonist: $protagonist)
-- }
--
--
-- This query defines an optional variable protagonist of type
-- String, its default value is "Zarathustra". If no default
-- value is defined and no value is provided, a variable can still be
-- null if its type is nullable.
--
-- Variables are usually passed along with the query, but not in the
-- query itself. They make queries reusable.
data VariableDefinition
VariableDefinition :: Name -> Type -> Maybe (Node ConstValue) -> Location -> VariableDefinition
-- | Escapes a single character according to the GraphQL escaping rules for
-- double-quoted string values.
--
-- Characters, that should be escaped, are written as escaped characters
-- with a backslash or Unicode with an "\u". Other characters are
-- returned as strings.
escape :: Char -> String
showVariableName :: VariableDefinition -> String
showVariable :: VariableDefinition -> String
instance GHC.Show.Show Language.GraphQL.AST.Document.Location
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Location
instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.GraphQL.AST.Document.Node a)
instance GHC.Show.Show Language.GraphQL.AST.Document.OperationType
instance GHC.Classes.Eq Language.GraphQL.AST.Document.OperationType
instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.GraphQL.AST.Document.ObjectField a)
instance GHC.Classes.Eq Language.GraphQL.AST.Document.ConstValue
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Value
instance GHC.Show.Show Language.GraphQL.AST.Document.Argument
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Argument
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Type
instance GHC.Classes.Eq Language.GraphQL.AST.Document.NonNullType
instance GHC.Show.Show Language.GraphQL.AST.Document.VariableDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.VariableDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.Directive
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Directive
instance GHC.Show.Show Language.GraphQL.AST.Document.FragmentSpread
instance GHC.Classes.Eq Language.GraphQL.AST.Document.FragmentSpread
instance GHC.Show.Show Language.GraphQL.AST.Document.InlineFragment
instance GHC.Classes.Eq Language.GraphQL.AST.Document.InlineFragment
instance GHC.Show.Show Language.GraphQL.AST.Document.Selection
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Selection
instance GHC.Show.Show Language.GraphQL.AST.Document.Field
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Field
instance GHC.Show.Show Language.GraphQL.AST.Document.FragmentDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.FragmentDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.OperationDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.OperationDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.ExecutableDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.ExecutableDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.OperationTypeDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.OperationTypeDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.SchemaExtension
instance GHC.Classes.Eq Language.GraphQL.AST.Document.SchemaExtension
instance GHC.Show.Show Language.GraphQL.AST.Document.Description
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Description
instance GHC.Show.Show Language.GraphQL.AST.Document.InputValueDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.InputValueDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.ArgumentsDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.ArgumentsDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.FieldDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.FieldDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.EnumValueDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.EnumValueDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.TypeExtension
instance GHC.Classes.Eq Language.GraphQL.AST.Document.TypeExtension
instance GHC.Show.Show Language.GraphQL.AST.Document.TypeSystemExtension
instance GHC.Classes.Eq Language.GraphQL.AST.Document.TypeSystemExtension
instance GHC.Show.Show Language.GraphQL.AST.Document.TypeDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.TypeDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.TypeSystemDefinition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.TypeSystemDefinition
instance GHC.Show.Show Language.GraphQL.AST.Document.Definition
instance GHC.Classes.Eq Language.GraphQL.AST.Document.Definition
instance Data.Foldable.Foldable t => GHC.Classes.Eq (Language.GraphQL.AST.Document.UnionMemberTypes t)
instance Data.Foldable.Foldable t => GHC.Show.Show (Language.GraphQL.AST.Document.UnionMemberTypes t)
instance GHC.Base.Semigroup Language.GraphQL.AST.Document.ArgumentsDefinition
instance GHC.Base.Monoid Language.GraphQL.AST.Document.ArgumentsDefinition
instance Data.Foldable.Foldable t => GHC.Classes.Eq (Language.GraphQL.AST.Document.ImplementsInterfaces t)
instance Data.Foldable.Foldable t => GHC.Show.Show (Language.GraphQL.AST.Document.ImplementsInterfaces t)
instance GHC.Base.Semigroup Language.GraphQL.AST.Document.Description
instance GHC.Base.Monoid Language.GraphQL.AST.Document.Description
instance GHC.Show.Show Language.GraphQL.AST.Document.Type
instance GHC.Show.Show Language.GraphQL.AST.Document.NonNullType
instance GHC.Show.Show Language.GraphQL.AST.Document.Value
instance GHC.Show.Show Language.GraphQL.AST.Document.ConstValue
instance GHC.Show.Show a => GHC.Show.Show (Language.GraphQL.AST.Document.ObjectField a)
instance GHC.Base.Functor Language.GraphQL.AST.Document.ObjectField
instance GHC.Show.Show a => GHC.Show.Show (Language.GraphQL.AST.Document.Node a)
instance GHC.Base.Functor Language.GraphQL.AST.Document.Node
instance GHC.Classes.Ord Language.GraphQL.AST.Document.Location
-- | This module defines a minifier and a printer for the GraphQL
-- language.
module Language.GraphQL.AST.Encoder
-- | Instructs the encoder whether the GraphQL document should be minified
-- or pretty printed.
--
-- Use pretty or minified to construct the formatter.
data Formatter
-- | Converts a ExecutableDefinition into a string.
definition :: Formatter -> ExecutableDefinition -> Text
-- | Converts a Directive into a string.
directive :: Formatter -> Directive -> Text
-- | Converts a Document' into a string.
document :: Formatter -> Document -> Text
-- | Constructs a formatter for minifying.
minified :: Formatter
-- | Produces lowercase operation type: query, mutation or subscription.
operationType :: Formatter -> OperationType -> Text
-- | Constructs a formatter for pretty printing.
pretty :: Formatter
-- | Converts a Type a type into a string.
type' :: Type -> Text
-- | Converts a TypeSystemDefinition into a string.
typeSystemDefinition :: Formatter -> TypeSystemDefinition -> Text
-- | Converts a Value into a string.
value :: Formatter -> Value -> Text
-- | This module defines a bunch of small parsers used to parse individual
-- lexemes.
module Language.GraphQL.AST.Lexer
-- | Standard parser. Accepts the type of the parsed token.
type Parser = Parsec Void Text
-- | Parser for "&".
amp :: Parser Text
-- | Parser for "@".
at :: Parser ()
-- | Parser for "!".
bang :: Parser Text
-- | Parser for block strings.
blockString :: Parser Text
-- | Parser for an expression between "{" and "}".
braces :: forall a. Parser a -> Parser a
-- | Parser for an expression between "[" and "]".
brackets :: forall a. Parser a -> Parser a
-- | Parser for ":".
colon :: Parser ()
-- | Parser for "$".
dollar :: Parser Text
-- | Parser for comments.
comment :: Parser ()
-- | Parser for "=".
equals :: Parser Text
-- | Parses "extend" followed by a symbol. It is used by schema
-- extensions.
extend :: forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
-- | Parser for integers.
integer :: Integral a => Parser a
-- | Parser for floating-point numbers.
float :: Parser Double
-- | Lexeme definition which ignores whitespaces and commas.
lexeme :: forall a. Parser a -> Parser a
-- | Parser for names ([_A-Za-z][_0-9A-Za-z]*).
name :: Parser Text
-- | Parser for an expression between "(" and ")".
parens :: forall a. Parser a -> Parser a
-- | Parser for "|".
pipe :: Parser Text
-- | Parser that skips comments and meaningless characters, whitespaces and
-- commas.
spaceConsumer :: Parser ()
-- | Parser for the spread operator (...).
spread :: Parser Text
-- | Parser for strings.
string :: Parser Text
-- | Symbol definition which ignores whitespaces and commas.
symbol :: Text -> Parser Text
-- | Parser for the "Byte Order Mark".
unicodeBOM :: Parser ()
-- | GraphQL document parser.
module Language.GraphQL.AST.Parser
-- | Parser for the GraphQL documents.
document :: Parser Document
-- | Target AST for parser.
module Language.GraphQL.AST
-- | This module contains a map data structure, that preserves insertion
-- order. Some definitions conflict with functions from prelude, so this
-- module should probably be imported qualified.
module Language.GraphQL.Execute.OrderedMap
-- | This map associates values with the given text keys. Insertion order
-- is preserved. When inserting a value with a key, that is already
-- available in the map, the existing value isn't overridden, but
-- combined with the new value using its Semigroup instance.
--
-- Internally this map uses an array with keys to preserve the order and
-- an unorded map with key-value pairs.
data OrderedMap v
-- | Returns a list with all elements in this map.
elems :: forall v. OrderedMap v -> [v]
-- | Constructs an empty map.
empty :: forall v. OrderedMap v
-- | Associates the specified value with the specified key in this map. If
-- this map previously contained a mapping for the key, the existing and
-- new values are combined.
insert :: Semigroup v => Text -> v -> OrderedMap v -> OrderedMap v
-- | Reduces this map by applying a binary operator from left to right to
-- all elements, using the given starting value.
foldlWithKey' :: forall v a. (a -> Text -> v -> a) -> a -> OrderedMap v -> a
-- | Returns a list with all keys in this map.
keys :: forall v. OrderedMap v -> [Text]
-- | Looks up a value in this map by key.
lookup :: forall v. Text -> OrderedMap v -> Maybe v
-- | Associates the specified value with the specified key in this map. If
-- this map previously contained a mapping for the key, the existing
-- value is replaced by the new one.
replace :: Text -> v -> OrderedMap v -> OrderedMap v
-- | Constructs a map with a single element.
singleton :: forall v. Text -> v -> OrderedMap v
-- | Gives the size of this map, i.e. number of elements in it.
size :: forall v. OrderedMap v -> Int
-- | Converts this map to the list of key-value pairs.
toList :: forall v. OrderedMap v -> [(Text, v)]
-- | Traverse over the elements and collect the Just results.
traverseMaybe :: Applicative f => forall a. (a -> f (Maybe b)) -> OrderedMap a -> f (OrderedMap b)
instance GHC.Classes.Eq v => GHC.Classes.Eq (Language.GraphQL.Execute.OrderedMap.OrderedMap v)
instance GHC.Base.Functor Language.GraphQL.Execute.OrderedMap.OrderedMap
instance Data.Foldable.Foldable Language.GraphQL.Execute.OrderedMap.OrderedMap
instance GHC.Base.Semigroup v => GHC.Base.Semigroup (Language.GraphQL.Execute.OrderedMap.OrderedMap v)
instance GHC.Base.Semigroup v => GHC.Base.Monoid (Language.GraphQL.Execute.OrderedMap.OrderedMap v)
instance Data.Traversable.Traversable Language.GraphQL.Execute.OrderedMap.OrderedMap
instance GHC.Show.Show v => GHC.Show.Show (Language.GraphQL.Execute.OrderedMap.OrderedMap v)
-- | Template Haskell helpers.
module Language.GraphQL.TH
-- | Removes leading and trailing newlines. Indentation of the first line
-- is removed from each line of the string.
gql :: QuasiQuoter
-- | Input types and values.
--
-- This module is intended to be imported qualified, to avoid name
-- clashes with Out.
module Language.GraphQL.Type.In
-- | Field argument definition.
data Argument
Argument :: Maybe Text -> Type -> Maybe Value -> Argument
-- | Field argument definitions.
type Arguments = HashMap Name Argument
-- | Single field of an InputObjectType.
data InputField
InputField :: Maybe Text -> Type -> Maybe Value -> InputField
-- | Input object type definition.
--
-- An input object defines a structured collection of fields which may be
-- supplied to a field argument.
data InputObjectType
InputObjectType :: Name -> Maybe Text -> HashMap Name InputField -> InputObjectType
-- | These types may be used as input types for arguments and directives.
--
-- GraphQL distinguishes between "wrapping" and "named" types. Each
-- wrapping type can wrap other wrapping or named types. Wrapping types
-- are lists and Non-Null types (named types are nullable by default).
data Type
NamedScalarType :: ScalarType -> Type
NamedEnumType :: EnumType -> Type
NamedInputObjectType :: InputObjectType -> Type
ListType :: Type -> Type
NonNullScalarType :: ScalarType -> Type
NonNullEnumType :: EnumType -> Type
NonNullInputObjectType :: InputObjectType -> Type
NonNullListType :: Type -> Type
-- | Checks whether the given input type is a non-null type.
isNonNullType :: Type -> Bool
-- | Matches either NamedEnumType or NonNullEnumType.
pattern EnumBaseType :: EnumType -> Type
-- | Matches either ListType or NonNullListType.
pattern ListBaseType :: Type -> Type
-- | Matches either NamedInputObjectType or
-- NonNullInputObjectType.
pattern InputObjectBaseType :: InputObjectType -> Type
-- | Matches either NamedScalarType or NonNullScalarType.
pattern ScalarBaseType :: ScalarType -> Type
instance GHC.Classes.Eq Language.GraphQL.Type.In.Type
instance GHC.Classes.Eq Language.GraphQL.Type.In.InputObjectType
instance GHC.Show.Show Language.GraphQL.Type.In.InputObjectType
instance GHC.Show.Show Language.GraphQL.Type.In.Type
-- | Output types and values, monad transformer stack used by the
-- GraphQL resolvers.
--
-- This module is intended to be imported qualified, to avoid name
-- clashes with In.
module Language.GraphQL.Type.Out
-- | Resolution context holds resolver arguments and the root value.
data Context
Context :: Arguments -> Value -> Context
[arguments] :: Context -> Arguments
[values] :: Context -> Value
-- | Output object field definition.
data Field m
Field :: Maybe Text -> Type m -> Arguments -> Field m
-- | Interface Type Definition.
--
-- When a field can return one of a heterogeneous set of types, a
-- Interface type is used to describe what types are possible, and what
-- fields are in common across all types.
data InterfaceType m
InterfaceType :: Name -> Maybe Text -> [InterfaceType m] -> HashMap Name (Field m) -> InterfaceType m
-- | Object type definition.
--
-- Almost all of the GraphQL types you define will be object types.
-- Object types have a name, but most importantly describe their fields.
data ObjectType m
ObjectType :: Name -> Maybe Text -> [InterfaceType m] -> HashMap Name (Resolver m) -> ObjectType m
-- | Monad transformer stack used by the resolvers for determining the
-- resolved value of a field.
type Resolve m = ReaderT Context m Value
-- | Monad transformer stack used by the resolvers for determining the
-- resolved event stream of a subscription field.
type Subscribe m = ReaderT Context m (SourceEventStream m)
-- | Resolver associates some function(s) with each Field.
-- ValueResolver resolves a Field into a Value.
-- EventStreamResolver resolves additionally a Field into a
-- SourceEventStream if it is the field of a root subscription
-- type.
--
-- The resolvers aren't part of the Field itself because not all
-- fields have resolvers (interface fields don't have an implementation).
data Resolver m
ValueResolver :: Field m -> Resolve m -> Resolver m
EventStreamResolver :: Field m -> Resolve m -> Subscribe m -> Resolver m
-- | A source stream represents the sequence of events, each of which will
-- trigger a GraphQL execution corresponding to that event.
type SourceEventStream m = ConduitT () Value m ()
-- | These types may be used as output types as the result of fields.
--
-- GraphQL distinguishes between "wrapping" and "named" types. Each
-- wrapping type can wrap other wrapping or named types. Wrapping types
-- are lists and Non-Null types (named types are nullable by default).
data Type m
NamedScalarType :: ScalarType -> Type m
NamedEnumType :: EnumType -> Type m
NamedObjectType :: ObjectType m -> Type m
NamedInterfaceType :: InterfaceType m -> Type m
NamedUnionType :: UnionType m -> Type m
ListType :: Type m -> Type m
NonNullScalarType :: ScalarType -> Type m
NonNullEnumType :: EnumType -> Type m
NonNullObjectType :: ObjectType m -> Type m
NonNullInterfaceType :: InterfaceType m -> Type m
NonNullUnionType :: UnionType m -> Type m
NonNullListType :: Type m -> Type m
-- | Union Type Definition.
--
-- When a field can return one of a heterogeneous set of types, a Union
-- type is used to describe what types are possible.
data UnionType m
UnionType :: Name -> Maybe Text -> [ObjectType m] -> UnionType m
-- | Retrieves an argument by its name. If the argument with this name
-- couldn't be found, returns Null (i.e. the argument is assumed
-- to be optional then).
argument :: Monad m => Name -> Resolve m
-- | Checks whether the given output type is a non-null type.
isNonNullType :: forall m. Type m -> Bool
-- | Matches either NamedEnumType or NonNullEnumType.
pattern EnumBaseType :: forall m. EnumType -> Type m
-- | Matches either NamedInterfaceType or
-- NonNullInterfaceType.
pattern InterfaceBaseType :: forall m. InterfaceType m -> Type m
-- | Matches either ListType or NonNullListType.
pattern ListBaseType :: forall m. Type m -> Type m
-- | Matches either NamedObjectType or NonNullObjectType.
pattern ObjectBaseType :: forall m. ObjectType m -> Type m
-- | Matches either NamedScalarType or NonNullScalarType.
pattern ScalarBaseType :: forall m. ScalarType -> Type m
-- | Matches either NamedUnionType or NonNullUnionType.
pattern UnionBaseType :: forall m. UnionType m -> Type m
instance GHC.Classes.Eq (Language.GraphQL.Type.Out.Type m)
instance GHC.Classes.Eq (Language.GraphQL.Type.Out.ObjectType a)
instance GHC.Show.Show (Language.GraphQL.Type.Out.ObjectType a)
instance GHC.Classes.Eq (Language.GraphQL.Type.Out.InterfaceType a)
instance GHC.Show.Show (Language.GraphQL.Type.Out.InterfaceType a)
instance GHC.Classes.Eq (Language.GraphQL.Type.Out.UnionType a)
instance GHC.Show.Show (Language.GraphQL.Type.Out.UnionType a)
instance GHC.Show.Show (Language.GraphQL.Type.Out.Type a)
-- | This module provides a representation of a GraphQL Schema in
-- addition to functions for defining and manipulating schemas.
module Language.GraphQL.Type.Schema
-- | Schema constructor.
--
-- Note: When the schema is constructed, by default only the types
-- that are reachable by traversing the root types are included, other
-- types must be explicitly referenced using schemaWithTypes
-- instead.
schema :: forall m. ObjectType m -> Maybe (ObjectType m) -> Maybe (ObjectType m) -> Directives -> Schema m
-- | Constructs a complete schema, including user-defined types not
-- referenced in the schema directly (for example interface
-- implementations).
schemaWithTypes :: forall m. Maybe Text -> ObjectType m -> Maybe (ObjectType m) -> Maybe (ObjectType m) -> [Type m] -> Directives -> Schema m
-- | These are all of the possible kinds of types.
data Type m
ScalarType :: ScalarType -> Type m
EnumType :: EnumType -> Type m
ObjectType :: ObjectType m -> Type m
InputObjectType :: InputObjectType -> Type m
InterfaceType :: InterfaceType m -> Type m
UnionType :: UnionType m -> Type m
-- | A Schema is created by supplying the root types of each type of
-- operation, query and mutation (optional). A schema definition is then
-- supplied to the validator and executor.
data Schema m
-- | Directive definition.
data Directive
Directive :: Maybe Text -> [DirectiveLocation] -> Arguments -> Directive
-- | Directive definitions.
type Directives = HashMap Name Directive
-- | Schema description.
description :: forall m. Schema m -> Maybe Text
-- | Schema directive definitions.
directives :: forall m. Schema m -> Directives
-- | Interface implementations.
implementations :: forall m. Schema m -> HashMap Name [Type m]
-- | Schema mutation type.
mutation :: forall m. Schema m -> Maybe (ObjectType m)
-- | Schema subscription type.
subscription :: forall m. Schema m -> Maybe (ObjectType m)
-- | Schema query type.
query :: forall m. Schema m -> ObjectType m
-- | Types referenced by the schema.
types :: forall m. Schema m -> HashMap Name (Type m)
-- | Reexports non-conflicting type system and schema definitions.
module Language.GraphQL.Type
-- | Single field of an InputObjectType.
data InputField
InputField :: Maybe Text -> Type -> Maybe Value -> InputField
-- | Input object type definition.
--
-- An input object defines a structured collection of fields which may be
-- supplied to a field argument.
data InputObjectType
InputObjectType :: Name -> Maybe Text -> HashMap Name InputField -> InputObjectType
-- | Resolution context holds resolver arguments and the root value.
data Context
Context :: Arguments -> Value -> Context
[arguments] :: Context -> Arguments
[values] :: Context -> Value
-- | Output object field definition.
data Field m
Field :: Maybe Text -> Type m -> Arguments -> Field m
-- | Interface Type Definition.
--
-- When a field can return one of a heterogeneous set of types, a
-- Interface type is used to describe what types are possible, and what
-- fields are in common across all types.
data InterfaceType m
InterfaceType :: Name -> Maybe Text -> [InterfaceType m] -> HashMap Name (Field m) -> InterfaceType m
-- | Object type definition.
--
-- Almost all of the GraphQL types you define will be object types.
-- Object types have a name, but most importantly describe their fields.
data ObjectType m
ObjectType :: Name -> Maybe Text -> [InterfaceType m] -> HashMap Name (Resolver m) -> ObjectType m
-- | Monad transformer stack used by the resolvers for determining the
-- resolved value of a field.
type Resolve m = ReaderT Context m Value
-- | Resolver associates some function(s) with each Field.
-- ValueResolver resolves a Field into a Value.
-- EventStreamResolver resolves additionally a Field into a
-- SourceEventStream if it is the field of a root subscription
-- type.
--
-- The resolvers aren't part of the Field itself because not all
-- fields have resolvers (interface fields don't have an implementation).
data Resolver m
ValueResolver :: Field m -> Resolve m -> Resolver m
EventStreamResolver :: Field m -> Resolve m -> Subscribe m -> Resolver m
-- | A source stream represents the sequence of events, each of which will
-- trigger a GraphQL execution corresponding to that event.
type SourceEventStream m = ConduitT () Value m ()
-- | Monad transformer stack used by the resolvers for determining the
-- resolved event stream of a subscription field.
type Subscribe m = ReaderT Context m (SourceEventStream m)
-- | Union Type Definition.
--
-- When a field can return one of a heterogeneous set of types, a Union
-- type is used to describe what types are possible.
data UnionType m
UnionType :: Name -> Maybe Text -> [ObjectType m] -> UnionType m
-- | Retrieves an argument by its name. If the argument with this name
-- couldn't be found, returns Null (i.e. the argument is assumed
-- to be optional then).
argument :: Monad m => Name -> Resolve m
-- | Argument list.
newtype Arguments
Arguments :: HashMap Name Value -> Arguments
-- | Directive.
data Directive
Directive :: Name -> Arguments -> Directive
-- | Enum type definition.
--
-- Some leaf values of requests and input values are Enums. GraphQL
-- serializes Enum values as strings, however internally Enums can be
-- represented by any kind of type, often integers.
data EnumType
EnumType :: Name -> Maybe Text -> HashMap Name EnumValue -> EnumType
-- | Enum value is a single member of an EnumType.
newtype EnumValue
EnumValue :: Maybe Text -> EnumValue
-- | Scalar type definition.
--
-- The leaf values of any request and input values to arguments are
-- Scalars (or Enums) .
data ScalarType
ScalarType :: Name -> Maybe Text -> ScalarType
-- | Contains variables for the query. The key of the map is a variable
-- name, and the value is the variable value.
type Subs = HashMap Name Value
-- | Represents accordingly typed GraphQL values.
data Value
Int :: Int32 -> Value
-- | GraphQL Float is double precision.
Float :: Double -> Value
String :: Text -> Value
Boolean :: Bool -> Value
Null :: Value
Enum :: Name -> Value
-- | Arbitrary nested list.
List :: [Value] -> Value
Object :: HashMap Name Value -> Value
-- | The Boolean scalar type represents true or
-- false.
boolean :: ScalarType
-- | The Float scalar type represents signed double-precision
-- fractional values as specified by IEEE 754.
float :: ScalarType
-- | The ID scalar type represents a unique identifier, often used
-- to refetch an object or as key for a cache. The ID type appears in a
-- JSON response as a String; however, it is not intended to be
-- human-readable. When expected as an input type, any string (such as
-- "4") or integer (such as 4) input value will be
-- accepted as an ID.
id :: ScalarType
-- | The Int scalar type represents non-fractional signed whole
-- numeric values. Int can represent values between <math> and
-- <math>.
int :: ScalarType
showNonNullType :: Show a => a -> String
showNonNullListType :: Show a => a -> String
-- | Takes a list of directives, handles supported directives and excludes
-- them from the result. If the selection should be skipped, returns
-- Nothing.
selection :: [Directive] -> Maybe [Directive]
-- | The String scalar type represents textual data, represented
-- as UTF-8 character sequences. The String type is most often used by
-- GraphQL to represent free-form human-readable text.
string :: ScalarType
-- | A Schema is created by supplying the root types of each type of
-- operation, query and mutation (optional). A schema definition is then
-- supplied to the validator and executor.
data Schema m
-- | Schema constructor.
--
-- Note: When the schema is constructed, by default only the types
-- that are reachable by traversing the root types are included, other
-- types must be explicitly referenced using schemaWithTypes
-- instead.
schema :: forall m. ObjectType m -> Maybe (ObjectType m) -> Maybe (ObjectType m) -> Directives -> Schema m
-- | Constructs a complete schema, including user-defined types not
-- referenced in the schema directly (for example interface
-- implementations).
schemaWithTypes :: forall m. Maybe Text -> ObjectType m -> Maybe (ObjectType m) -> Maybe (ObjectType m) -> [Type m] -> Directives -> Schema m
-- | Types and functions used for input and result coercion.
module Language.GraphQL.Execute.Coerce
-- | Intermediate type used to serialize a GraphQL value.
--
-- The serialization is done during the execution, and Output
-- contains already serialized data (in List and Object) as
-- well as the new layer that has to be serialized in the current step.
-- So Output is parameterized by the serialization format.
data Output a
Int :: Int32 -> Output a
Float :: Double -> Output a
String :: Text -> Output a
Boolean :: Bool -> Output a
Enum :: Name -> Output a
List :: [a] -> Output a
Object :: OrderedMap a -> Output a
-- | Serialize describes how a GraphQL value should be
-- serialized.
class Serialize a
-- | Serializes a GraphQL value according to the given
-- serialization format.
--
-- Type infomration is given as a hint, e.g. if you need to know what
-- type is being serialized to serialize it properly. Don't do any
-- validation for GraphQL built-in types here.
--
-- If the value cannot be serialized without losing information, return
-- Nothing — it will cause a field error.
serialize :: forall m. Serialize a => Type m -> Output a -> Maybe a
null :: Serialize a => a
-- | Since variables are passed separately from the query, in an
-- independent format, they should be first coerced to the internal
-- representation used by this implementation.
class VariableValue a
-- | Only a basic, format-specific, coercion must be done here. Type
-- correctness or nullability shouldn't be validated here, they will be
-- validated later. The type information is provided only as a hint.
--
-- For example GraphQL prohibits the coercion from a 't:Float'
-- to an 't:Int', but JSON doesn't have integers, so whole
-- numbers should be coerced to 't:Int` when receiving variables as a
-- JSON object. The same holds for 't:Enum'. There are formats that
-- support enumerations, JSON doesn't, so the type information
-- is given and coerceVariableValue can check that an 't:Enum' is
-- expected and treat the given value appropriately. Even checking
-- whether this value is a proper member of the corresponding 't:Enum'
-- type isn't required here, since this can be checked independently.
--
-- Another example is an ID. GraphQL explicitly allows
-- to coerce integers and strings to IDs, so if an ID
-- is received as an integer, it can be left as is and will be coerced
-- later.
--
-- If a value cannot be coerced without losing information,
-- Nothing should be returned, the coercion will fail then and the
-- query won't be executed.
coerceVariableValue :: VariableValue a => Type -> a -> Maybe Value
-- | Coerces operation arguments according to the input coercion rules for
-- the corresponding types.
coerceInputLiteral :: Type -> Value -> Maybe Value
-- | Looks up a value by name in the given map, coerces it and inserts into
-- the result map. If the coercion fails, returns Nothing. If the
-- value isn't given, but a default value is known, inserts the default
-- value into the result map. Otherwise it fails with Nothing if
-- the Input Type is a Non-Nullable type, or returns the unchanged,
-- original map.
matchFieldValues :: forall a. (Type -> a -> Maybe Value) -> HashMap Name a -> Name -> Type -> Maybe Value -> Maybe (HashMap Name Value) -> Maybe (HashMap Name Value)
instance GHC.Show.Show a => GHC.Show.Show (Language.GraphQL.Execute.Coerce.Output a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.GraphQL.Execute.Coerce.Output a)
instance Language.GraphQL.Execute.Coerce.Serialize Language.GraphQL.Type.Definition.Value
instance Data.String.IsString (Language.GraphQL.Execute.Coerce.Output a)
instance Language.GraphQL.Execute.Coerce.VariableValue Language.GraphQL.Type.Definition.Value
-- | Error handling.
module Language.GraphQL.Error
-- | A wrapper to pass error messages around.
-- | Deprecated: CollectErrsT was part of the old executor and isn't
-- used anymore
type CollectErrsT m = StateT (Resolution m) m
-- | GraphQL error.
data Error
Error :: Text -> [Location] -> [Path] -> Error
[$sel:message:Error] :: Error -> Text
[$sel:locations:Error] :: Error -> [Location]
[$sel:path:Error] :: Error -> [Path]
-- | If an error can be associated to a particular field in the GraphQL
-- result, it must contain an entry with the key path that details the
-- path of the response field which experienced the error. This allows
-- clients to identify whether a null result is intentional or caused by
-- a runtime error.
data Path
-- | Field name.
Segment :: Text -> Path
-- | List index if a field returned a list.
Index :: Int -> Path
-- | Executor context.
-- | Deprecated: Resolution was part of the old executor and isn't used
-- anymore
data Resolution m
-- | Deprecated: Resolution was part of the old executor and isn't used
-- anymore
Resolution :: Seq Error -> HashMap Name (Type m) -> Resolution m
[$sel:errors:Resolution] :: Resolution m -> Seq Error
[$sel:types:Resolution] :: Resolution m -> HashMap Name (Type m)
-- | Only exceptions that inherit from ResolverException a cought by
-- the executor.
data ResolverException
ResolverException :: e -> ResolverException
-- | The server's response describes the result of executing the requested
-- operation if successful, and describes any errors encountered during
-- the request.
data Response a
Response :: a -> Seq Error -> Response a
[$sel:data':Response] :: Response a -> a
[$sel:errors:Response] :: Response a -> Seq Error
-- | Each event in the underlying Source Stream triggers execution of the
-- subscription selection set. The results of the execution generate a
-- Response Stream.
type ResponseEventStream m a = ConduitT () (Response a) m ()
-- | Wraps a parse error into a list of errors.
parseError :: (Applicative f, Serialize a) => ParseErrorBundle Text Void -> f (Response a)
-- | Runs the given query computation, but collects the errors into an
-- error list, which is then sent back with the data.
-- | Deprecated: runCollectErrs was part of the old executor and isn't
-- used anymore
runCollectErrs :: (Monad m, Serialize a) => HashMap Name (Type m) -> CollectErrsT m a -> m (Response a)
instance GHC.Show.Show Language.GraphQL.Error.Path
instance GHC.Classes.Eq Language.GraphQL.Error.Path
instance GHC.Show.Show Language.GraphQL.Error.Error
instance GHC.Classes.Eq Language.GraphQL.Error.Error
instance GHC.Show.Show a => GHC.Show.Show (Language.GraphQL.Error.Response a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.GraphQL.Error.Response a)
instance GHC.Show.Show Language.GraphQL.Error.ResolverException
instance GHC.Exception.Type.Exception Language.GraphQL.Error.ResolverException
-- | This module provides functions to execute a GraphQL request.
module Language.GraphQL.Execute
-- | The substitution is applied to the document, and the resolvers are
-- applied to the resulting fields. The operation name can be used if the
-- document defines multiple root operations.
--
-- Returns the result of the query against the schema wrapped in a
-- data field, or errors wrapped in an errors field.
execute :: (MonadCatch m, VariableValue a, Serialize b) => Schema m -> Maybe Text -> HashMap Name a -> Document -> m (Either (ResponseEventStream m b) (Response b))
instance GHC.Show.Show Language.GraphQL.Execute.ResultCoercionException
instance GHC.Exception.Type.Exception Language.GraphQL.Execute.ResultCoercionException
instance GHC.Show.Show Language.GraphQL.Execute.InputCoercionException
instance GHC.Exception.Type.Exception Language.GraphQL.Execute.InputCoercionException
instance GHC.Show.Show Language.GraphQL.Execute.ValueCompletionException
instance GHC.Exception.Type.Exception Language.GraphQL.Execute.ValueCompletionException
instance GHC.Show.Show Language.GraphQL.Execute.FieldException
instance GHC.Exception.Type.Exception Language.GraphQL.Execute.FieldException
instance GHC.Show.Show Language.GraphQL.Execute.ResultException
instance GHC.Exception.Type.Exception Language.GraphQL.Execute.ResultException
instance GHC.Show.Show Language.GraphQL.Execute.GraphQLException
instance GHC.Exception.Type.Exception Language.GraphQL.Execute.GraphQLException
instance GHC.Base.Functor m => GHC.Base.Functor (Language.GraphQL.Execute.ExecutorT m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (Language.GraphQL.Execute.ExecutorT m)
instance GHC.Base.Monad m => GHC.Base.Monad (Language.GraphQL.Execute.ExecutorT m)
instance Control.Monad.Trans.Class.MonadTrans Language.GraphQL.Execute.ExecutorT
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (Language.GraphQL.Execute.ExecutorT m)
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (Language.GraphQL.Execute.ExecutorT m)
-- | Definitions used by the validation rules and the validator itself.
module Language.GraphQL.Validate.Validation
-- | Validation error.
data Error
Error :: String -> [Location] -> Error
[message] :: Error -> String
[locations] :: Error -> [Location]
-- | Rule assigns a function to each AST node that can be validated.
-- If the validation fails, the function should return an error message,
-- or Nothing otherwise.
data Rule m
DefinitionRule :: (Definition -> RuleT m) -> Rule m
OperationDefinitionRule :: (OperationDefinition -> RuleT m) -> Rule m
FragmentDefinitionRule :: (FragmentDefinition -> RuleT m) -> Rule m
SelectionRule :: (Maybe (Type m) -> Selection -> RuleT m) -> Rule m
FragmentRule :: (FragmentDefinition -> RuleT m) -> (InlineFragment -> RuleT m) -> Rule m
FragmentSpreadRule :: (FragmentSpread -> RuleT m) -> Rule m
FieldRule :: (Maybe (Type m) -> Field -> RuleT m) -> Rule m
ArgumentsRule :: (Maybe (Type m) -> Field -> RuleT m) -> (Directive -> RuleT m) -> Rule m
DirectivesRule :: (DirectiveLocation -> [Directive] -> RuleT m) -> Rule m
VariablesRule :: ([VariableDefinition] -> RuleT m) -> Rule m
ValueRule :: (Maybe Type -> Node Value -> RuleT m) -> (Maybe Type -> Node ConstValue -> RuleT m) -> Rule m
-- | Monad transformer used by the rules.
type RuleT m = ReaderT (Validation m) Seq Error
-- | Validation rule context.
data Validation m
Validation :: Document -> Schema m -> Validation m
[ast] :: Validation m -> Document
[schema] :: Validation m -> Schema m
instance GHC.Show.Show Language.GraphQL.Validate.Validation.Error
instance GHC.Classes.Eq Language.GraphQL.Validate.Validation.Error
-- | GraphQL validator.
module Language.GraphQL.Validate
-- | Validation error.
data Error
Error :: String -> [Location] -> Error
[message] :: Error -> String
[locations] :: Error -> [Location]
-- | Validates a document and returns a list of found errors. If the
-- returned list is empty, the document is valid.
document :: forall m. Schema m -> [Rule m] -> Document -> Seq Error
-- | GraphQL servers define what directives they support and where they
-- support them. For each usage of a directive, the directive must be
-- used in a location that the server has declared support for.
directivesInValidLocationsRule :: Rule m
-- | Definition must be OperationDefinition or FragmentDefinition.
executableDefinitionsRule :: forall m. Rule m
-- | The target field of a field selection must be defined on the scoped
-- type of the selection set. There are no limitations on alias names.
fieldsOnCorrectTypeRule :: forall m. Rule m
-- | Fragments can only be declared on unions, interfaces, and objects.
-- They are invalid on scalars. They can only be applied on non‐leaf
-- fields. This rule applies to both inline and named fragments.
fragmentsOnCompositeTypesRule :: forall m. Rule m
-- | Named fragment spreads must refer to fragments defined within the
-- document. It is a validation error if the target of a spread is not
-- defined.
fragmentSpreadTargetDefinedRule :: forall m. Rule m
-- | Fragments must be specified on types that exist in the schema. This
-- applies for both named and inline fragments. If they are not defined
-- in the schema, the query does not validate.
fragmentSpreadTypeExistenceRule :: forall m. Rule m
-- | GraphQL allows a short‐hand form for defining query operations when
-- only that one operation exists in the document.
loneAnonymousOperationRule :: forall m. Rule m
-- | Every argument provided to a field or directive must be defined in the
-- set of possible arguments of that field or directive.
knownArgumentNamesRule :: forall m. Rule m
-- | GraphQL servers define what directives they support. For each usage of
-- a directive, the directive must be available on that server.
knownDirectiveNamesRule :: Rule m
-- | Every input field provided in an input object value must be defined in
-- the set of possible fields of that input object’s expected type.
knownInputFieldNamesRule :: Rule m
-- | The graph of fragment spreads must not form any cycles including
-- spreading itself. Otherwise an operation could infinitely spread or
-- infinitely execute on cycles in the underlying data.
noFragmentCyclesRule :: forall m. Rule m
-- | Variables are scoped on a per‐operation basis. That means that any
-- variable used within the context of an operation must be defined at
-- the top level of that operation.
noUndefinedVariablesRule :: forall m. Rule m
-- | Defined fragments must be used within a document.
noUnusedFragmentsRule :: forall m. Rule m
-- | All variables defined by an operation must be used in that operation
-- or a fragment transitively included by that operation. Unused
-- variables cause a validation error.
noUnusedVariablesRule :: forall m. Rule m
-- | If multiple field selections with the same response names are
-- encountered during execution, the field and arguments to execute and
-- the resulting value should be unambiguous. Therefore any two field
-- selections which might both be encountered for the same object are
-- only valid if they are equivalent.
--
-- For simple hand‐written GraphQL, this rule is obviously a clear
-- developer error, however nested fragments can make this difficult to
-- detect manually.
overlappingFieldsCanBeMergedRule :: Rule m
-- | Fragments are declared on a type and will only apply when the runtime
-- object type matches the type condition. They also are spread within
-- the context of a parent type. A fragment spread is only valid if its
-- type condition could ever apply within the parent type.
possibleFragmentSpreadsRule :: forall m. Rule m
-- | Input object fields may be required. Much like a field may have
-- required arguments, an input object may have required fields. An input
-- field is required if it has a non‐null type and does not have a
-- default value. Otherwise, the input object field is optional.
providedRequiredInputFieldsRule :: Rule m
-- | Arguments can be required. An argument is required if the argument
-- type is non‐null and does not have a default value. Otherwise, the
-- argument is optional.
providedRequiredArgumentsRule :: Rule m
-- | Field selections on scalars or enums are never allowed, because they
-- are the leaf nodes of any GraphQL query.
scalarLeafsRule :: forall m. Rule m
-- | Subscription operations must have exactly one root field.
singleFieldSubscriptionsRule :: forall m. Rule m
-- | Default rules given in the specification.
specifiedRules :: forall m. [Rule m]
-- | Fields and directives treat arguments as a mapping of argument name to
-- value. More than one argument with the same name in an argument set is
-- ambiguous and invalid.
uniqueArgumentNamesRule :: forall m. Rule m
-- | Directives are used to describe some metadata or behavioral change on
-- the definition they apply to. When more than one directive of the same
-- name is used, the expected metadata or behavior becomes ambiguous,
-- therefore only one of each directive is allowed per location.
uniqueDirectiveNamesRule :: forall m. Rule m
-- | Fragment definitions are referenced in fragment spreads by name. To
-- avoid ambiguity, each fragment’s name must be unique within a
-- document.
--
-- Inline fragments are not considered fragment definitions, and are
-- unaffected by this validation rule.
uniqueFragmentNamesRule :: forall m. Rule m
-- | Input objects must not contain more than one field of the same name,
-- otherwise an ambiguity would exist which includes an ignored portion
-- of syntax.
uniqueInputFieldNamesRule :: forall m. Rule m
-- | Each named operation definition must be unique within a document when
-- referred to by its name.
uniqueOperationNamesRule :: forall m. Rule m
-- | If any operation defines more than one variable with the same name, it
-- is ambiguous and invalid. It is invalid even if the type of the
-- duplicate variable is the same.
uniqueVariableNamesRule :: forall m. Rule m
-- | Literal values must be compatible with the type expected in the
-- position they are found as per the coercion rules.
--
-- The type expected in a position include the type defined by the
-- argument a value is provided for, the type defined by an input object
-- field a value is provided for, and the type of a variable definition a
-- default value is provided for.
valuesOfCorrectTypeRule :: forall m. Rule m
-- | Variable usages must be compatible with the arguments they are passed
-- to.
--
-- Validation failures occur when variables are used in the context of
-- types that are complete mismatches, or if a nullable type in a
-- variable is passed to a non‐null argument type.
variablesInAllowedPositionRule :: forall m. Rule m
-- | Variables can only be input types. Objects, unions and interfaces
-- cannot be used as inputs.
variablesAreInputTypesRule :: forall m. Rule m
-- | This module provides the functions to parse and execute
-- GraphQL queries.
module Language.GraphQL
-- | If the text parses correctly as a GraphQL query the query is
-- executed using the given Schema.
--
-- An operation name can be given if the document contains multiple
-- operations.
graphql :: (MonadCatch m, VariableValue a, Serialize b) => Schema m -> Maybe Text -> HashMap Name a -> Text -> m (Either (ResponseEventStream m b) (Response b))