-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell GraphQL implementation -- -- This package provides a rudimentary parser for the GraphQL -- language. @package graphql @version 0.7.0.0 -- | 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.Show.Show Language.GraphQL.AST.DirectiveLocation.DirectiveLocation instance GHC.Classes.Eq Language.GraphQL.AST.DirectiveLocation.DirectiveLocation instance GHC.Show.Show Language.GraphQL.AST.DirectiveLocation.TypeSystemDirectiveLocation instance GHC.Classes.Eq Language.GraphQL.AST.DirectiveLocation.TypeSystemDirectiveLocation instance GHC.Show.Show Language.GraphQL.AST.DirectiveLocation.ExecutableDirectiveLocation instance GHC.Classes.Eq 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 -- | Alternative field name. -- --
--   {
--     smallPic: profilePic(size: 64)
--     bigPic: profilePic(size: 1024)
--   }
--   
-- -- Here "smallPic" and "bigPic" are aliases for the same field, -- "profilePic", used to distinquish between profile pictures with -- different arguments (sizes). type Alias = Name -- | Single argument. -- --
--   {
--     user(id: 4) {
--       name
--     }
--   }
--   
-- -- Here "id" is an argument for the field "user" and its value is 4. data Argument Argument :: Name -> Value -> 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 -- | All kinds of definitions that can occur in a GraphQL document. data Definition ExecutableDefinition :: ExecutableDefinition -> Definition TypeSystemDefinition :: TypeSystemDefinition -> Definition TypeSystemExtension :: TypeSystemExtension -> 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] -> 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 -- | 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 -> FragmentDefinition -- | 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 -- | 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 Value -> [Directive] -> InputValueDefinition -- | Name. type Name = Text -- | Represents type names. type NamedType = Name -- | 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 ObjectField :: Name -> Value -> ObjectField -- | Operation definition. data OperationDefinition SelectionSet :: SelectionSet -> OperationDefinition OperationDefinition :: OperationType -> Maybe Name -> [VariableDefinition] -> [Directive] -> SelectionSet -> OperationDefinition -- | GraphQL has 3 operation types: -- -- -- -- Currently only queries and mutations are supported. data OperationType Query :: OperationType Mutation :: OperationType -- | Root operation type definition. -- -- Defining root operation types is not required since they have -- defaults. So the default query root type is Query, and the -- default mutation root type is Mutation. But these defaults can -- be changed for a specific schema. In the following code the query root -- type is changed to MyQueryRootType, and the mutation root type -- to MyMutationRootType: -- --
--   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, fragment spread or inline fragment. -- -- 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
--     }
--   }
--   
-- -- 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
--   }
--   
-- -- Inline fragments are similar but they don't have any name and the type -- condition ("on UserType") is optional. -- --
--   {
--     user {
--       ... on UserType {
--         id
--         name
--       }
--   }
--   
data Selection Field :: Maybe Alias -> Name -> [Argument] -> [Directive] -> SelectionSetOpt -> Selection FragmentSpread :: Name -> [Directive] -> Selection InlineFragment :: Maybe TypeCondition -> [Directive] -> SelectionSet -> 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. data Value Variable :: Name -> Value Int :: Int32 -> Value Float :: Double -> Value String :: Text -> Value Boolean :: Bool -> Value Null :: Value Enum :: Name -> Value List :: [Value] -> Value Object :: [ObjectField] -> Value -- | Variable definition. data VariableDefinition VariableDefinition :: Name -> Type -> Maybe Value -> VariableDefinition instance GHC.Show.Show Language.GraphQL.AST.Document.Definition instance GHC.Classes.Eq Language.GraphQL.AST.Document.Definition 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.TypeDefinition instance GHC.Classes.Eq Language.GraphQL.AST.Document.TypeDefinition 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.TypeExtension instance GHC.Classes.Eq Language.GraphQL.AST.Document.TypeExtension 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.FieldDefinition instance GHC.Classes.Eq Language.GraphQL.AST.Document.FieldDefinition 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.InputValueDefinition instance GHC.Classes.Eq Language.GraphQL.AST.Document.InputValueDefinition 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.SchemaExtension instance GHC.Classes.Eq Language.GraphQL.AST.Document.SchemaExtension 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.ExecutableDefinition instance GHC.Classes.Eq Language.GraphQL.AST.Document.ExecutableDefinition 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.FragmentDefinition instance GHC.Classes.Eq Language.GraphQL.AST.Document.FragmentDefinition 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.Directive instance GHC.Classes.Eq Language.GraphQL.AST.Document.Directive 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.Type instance GHC.Classes.Eq Language.GraphQL.AST.Document.Type instance GHC.Show.Show Language.GraphQL.AST.Document.NonNullType instance GHC.Classes.Eq Language.GraphQL.AST.Document.NonNullType instance GHC.Show.Show Language.GraphQL.AST.Document.Argument instance GHC.Classes.Eq Language.GraphQL.AST.Document.Argument instance GHC.Show.Show Language.GraphQL.AST.Document.Value instance GHC.Classes.Eq Language.GraphQL.AST.Document.Value instance GHC.Show.Show Language.GraphQL.AST.Document.ObjectField instance GHC.Classes.Eq Language.GraphQL.AST.Document.ObjectField instance GHC.Show.Show Language.GraphQL.AST.Document.OperationType instance GHC.Classes.Eq Language.GraphQL.AST.Document.OperationType 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) -- | Target AST for Parser. module Language.GraphQL.AST -- | This is the AST meant to be executed. module Language.GraphQL.AST.Core -- | Alternative field name. -- --
--   {
--     smallPic: profilePic(size: 64)
--     bigPic: profilePic(size: 1024)
--   }
--   
-- -- Here "smallPic" and "bigPic" are aliases for the same field, -- "profilePic", used to distinquish between profile pictures with -- different arguments (sizes). type Alias = Name -- | Argument list. newtype Arguments Arguments :: HashMap Name Value -> Arguments -- | Directive. data Directive Directive :: Name -> Arguments -> Directive -- | GraphQL document is a non-empty list of operations. type Document = NonEmpty Operation -- | Single GraphQL field. data Field Field :: Maybe Alias -> Name -> Arguments -> Seq Selection -> Field -- | Represents fragments and inline fragments. data Fragment Fragment :: TypeCondition -> Seq Selection -> Fragment -- | Name. type Name = Text -- | GraphQL has 3 operation types: queries, mutations and subscribtions. -- -- Currently only queries and mutations are supported. data Operation Query :: Maybe Text -> Seq Selection -> Operation Mutation :: Maybe Text -> Seq Selection -> Operation -- | Single selection element. data Selection SelectionFragment :: Fragment -> Selection SelectionField :: Field -> Selection -- | Type condition. type TypeCondition = Name -- | 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 List :: [Value] -> Value Object :: HashMap Name Value -> Value instance GHC.Show.Show Language.GraphQL.AST.Core.Operation instance GHC.Classes.Eq Language.GraphQL.AST.Core.Operation instance GHC.Show.Show Language.GraphQL.AST.Core.Fragment instance GHC.Classes.Eq Language.GraphQL.AST.Core.Fragment instance GHC.Show.Show Language.GraphQL.AST.Core.Selection instance GHC.Classes.Eq Language.GraphQL.AST.Core.Selection instance GHC.Show.Show Language.GraphQL.AST.Core.Field instance GHC.Classes.Eq Language.GraphQL.AST.Core.Field instance GHC.Show.Show Language.GraphQL.AST.Core.Directive instance GHC.Classes.Eq Language.GraphQL.AST.Core.Directive instance GHC.Show.Show Language.GraphQL.AST.Core.Arguments instance GHC.Classes.Eq Language.GraphQL.AST.Core.Arguments instance GHC.Show.Show Language.GraphQL.AST.Core.Value instance GHC.Classes.Eq Language.GraphQL.AST.Core.Value instance GHC.Base.Semigroup Language.GraphQL.AST.Core.Arguments instance GHC.Base.Monoid Language.GraphQL.AST.Core.Arguments instance Data.String.IsString Language.GraphQL.AST.Core.Value -- | 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 tDefinition 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 -- | Constructs a formatter for pretty printing. pretty :: Formatter -- | Converts a Type a type into a string. type' :: Type -> 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 Text -- | 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 Text -- | 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 -- | Error handling. module Language.GraphQL.Error -- | Wraps a parse error into a list of errors. parseError :: Applicative f => ParseErrorBundle Text Void -> f Value -- | A wrapper to pass error messages around. type CollectErrsT m = StateT [Value] m -- | Adds an error to the list of errors. addErr :: Monad m => Value -> CollectErrsT m () -- | Convenience function for just wrapping an error message. addErrMsg :: Monad m => Text -> CollectErrsT m () -- | Runs the given query computation, but collects the errors into an -- error list, which is then sent back with the data. runCollectErrs :: Monad m => CollectErrsT m Value -> m Value -- | Runs the given computation, collecting the errors and appending them -- to the previous list of errors. runAppendErrs :: Monad m => CollectErrsT m a -> CollectErrsT m a -- | Constructs a response object containing only the error with the given -- message. singleError :: Text -> Value -- | Monad transformer stack used by the GraphQL resolvers. module Language.GraphQL.Trans -- | Monad transformer stack used by the resolvers to provide error -- handling and resolution context (resolver arguments). newtype ActionT m a ActionT :: ExceptT Text (ReaderT Context m) a -> ActionT m a [runActionT] :: ActionT m a -> ExceptT Text (ReaderT Context m) a -- | Resolution context holds resolver arguments. newtype Context Context :: Arguments -> Context [arguments] :: Context -> Arguments -- | 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 -> ActionT m Value instance GHC.Base.Functor m => GHC.Base.Functor (Language.GraphQL.Trans.ActionT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Language.GraphQL.Trans.ActionT m) instance GHC.Base.Monad m => GHC.Base.Monad (Language.GraphQL.Trans.ActionT m) instance Control.Monad.Trans.Class.MonadTrans Language.GraphQL.Trans.ActionT instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Language.GraphQL.Trans.ActionT m) instance GHC.Base.Monad m => GHC.Base.Alternative (Language.GraphQL.Trans.ActionT m) instance GHC.Base.Monad m => GHC.Base.MonadPlus (Language.GraphQL.Trans.ActionT m) -- | Definitions for GraphQL input types. module Language.GraphQL.Type -- | 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). -- -- This Wrapping type doesn't reflect this distinction exactly but -- it is used in the resolvers to take into account that the returned -- value can be nullable or an (arbitrary nested) list. data Wrapping a -- | Arbitrary nested list List :: [Wrapping a] -> Wrapping a -- | Named type without further wrapping Named :: a -> Wrapping a -- | Null Null :: Wrapping a instance GHC.Show.Show a => GHC.Show.Show (Language.GraphQL.Type.Wrapping a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.GraphQL.Type.Wrapping a) instance GHC.Base.Functor Language.GraphQL.Type.Wrapping instance Data.Foldable.Foldable Language.GraphQL.Type.Wrapping instance Data.Traversable.Traversable Language.GraphQL.Type.Wrapping instance GHC.Base.Applicative Language.GraphQL.Type.Wrapping instance GHC.Base.Monad Language.GraphQL.Type.Wrapping instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.GraphQL.Type.Wrapping a) -- | This module provides a representation of a GraphQL Schema in -- addition to functions for defining and manipulating schemas. module Language.GraphQL.Schema -- | Resolves a Field into an Aeson.Object with -- error information (if an error has occurred). m is an -- arbitrary monad, usually IO. data Resolver m Resolver :: Text -> (Field -> CollectErrsT m Object) -> Resolver m -- | 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 -- | Create a new Resolver with the given Name from the given -- Resolvers. object :: Monad m => Name -> ActionT m [Resolver m] -> Resolver m -- | Takes a list of Resolvers and a list of Fields and -- applies each Resolver to each Field. Resolves into a -- value containing the resolved Field, or a null value and error -- information. resolve :: Monad m => HashMap Text (Field -> CollectErrsT m Object) -> Seq Selection -> CollectErrsT m Value -- | Converts resolvers to a map. resolversToMap :: (Foldable f, Functor f) => f (Resolver m) -> HashMap Text (Field -> CollectErrsT m Object) -- | A scalar represents a primitive value, like a string or an integer. scalar :: (Monad m, ToJSON a) => Name -> ActionT m a -> Resolver m -- | Like object but can be null or a list of objects. wrappedObject :: Monad m => Name -> ActionT m (Wrapping [Resolver m]) -> Resolver m -- | Like scalar but can be null or a list of scalars. wrappedScalar :: (Monad m, ToJSON a) => Name -> ActionT m (Wrapping a) -> Resolver m -- | Single GraphQL field. data Field -- | 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 List :: [Value] -> Value Object :: HashMap Name Value -> Value -- | 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. -- -- Returns the result of the query against the schema wrapped in a -- data field, or errors wrapped in an errors field. execute :: Monad m => HashMap Text (NonEmpty (Resolver m)) -> Subs -> Document -> m Value -- | 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. executeWithName :: Monad m => HashMap Text (NonEmpty (Resolver m)) -> Text -> Subs -> Document -> m Value -- | 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 Resolvers. graphql :: Monad m => HashMap Text (NonEmpty (Resolver m)) -> Text -> m Value -- | If the text parses correctly as a GraphQL query the -- substitution is applied to the query and the query is then executed -- using to the given Resolvers. graphqlSubs :: Monad m => HashMap Text (NonEmpty (Resolver m)) -> Subs -> Text -> m Value