Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module defines an abstract syntax tree for the GraphQL
language based on
Facebook's GraphQL Specification.
Target AST for Parser.
Synopsis
- type Alias = Name
- data Argument = Argument Name Value
- data Definition
- data Directive = Directive Name [Argument]
- type Document = NonEmpty Definition
- data Field = Field (Maybe Alias) Name [Argument] [Directive] SelectionSetOpt
- data FragmentDefinition = FragmentDefinition Name TypeCondition [Directive] SelectionSet
- data FragmentSpread = FragmentSpread Name [Directive]
- data InlineFragment = InlineFragment (Maybe TypeCondition) [Directive] SelectionSet
- type Name = Text
- data NonNullType
- data ObjectField = ObjectField Name Value
- data OperationDefinition
- data OperationType
- data Selection
- type SelectionSet = NonEmpty Selection
- type SelectionSetOpt = [Selection]
- data Type
- type TypeCondition = Name
- data Value
- data VariableDefinition = VariableDefinition Name Type (Maybe Value)
Documentation
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).
Single argument.
{ user(id: 4) { name } }
Here "id" is an argument for the field "user" and its value is 4.
data Definition Source #
Top-level definition of a document, either an operation or a fragment.
Instances
Eq Definition Source # | |
Defined in Language.GraphQL.AST (==) :: Definition -> Definition -> Bool # (/=) :: Definition -> Definition -> Bool # | |
Show Definition Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> Definition -> ShowS # show :: Definition -> String # showList :: [Definition] -> ShowS # |
type Document = NonEmpty Definition Source #
GraphQL document.
Single GraphQL field.
The only required property of a field is its name. Optionally it can also have an alias, arguments or a list of subfields.
Given the following query:
{ zuck: user(id: 4) { id name } }
- "user", "id" and "name" are field names.
- "user" has two subfields, "id" and "name".
- "zuck" is an alias for "user". "id" and "name" have no aliases.
- "id: 4" is an argument for "user". "id" and "name" don't have any arguments.
data FragmentDefinition Source #
Fragment definition.
Instances
Eq FragmentDefinition Source # | |
Defined in Language.GraphQL.AST (==) :: FragmentDefinition -> FragmentDefinition -> Bool # (/=) :: FragmentDefinition -> FragmentDefinition -> Bool # | |
Show FragmentDefinition Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> FragmentDefinition -> ShowS # show :: FragmentDefinition -> String # showList :: [FragmentDefinition] -> ShowS # |
data FragmentSpread Source #
Fragment spread.
Instances
Eq FragmentSpread Source # | |
Defined in Language.GraphQL.AST (==) :: FragmentSpread -> FragmentSpread -> Bool # (/=) :: FragmentSpread -> FragmentSpread -> Bool # | |
Show FragmentSpread Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> FragmentSpread -> ShowS # show :: FragmentSpread -> String # showList :: [FragmentSpread] -> ShowS # |
data InlineFragment Source #
Inline fragment.
Instances
Eq InlineFragment Source # | |
Defined in Language.GraphQL.AST (==) :: InlineFragment -> InlineFragment -> Bool # (/=) :: InlineFragment -> InlineFragment -> Bool # | |
Show InlineFragment Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> InlineFragment -> ShowS # show :: InlineFragment -> String # showList :: [InlineFragment] -> ShowS # |
data NonNullType Source #
Helper type to represent Non-Null types and lists of such types.
Instances
Eq NonNullType Source # | |
Defined in Language.GraphQL.AST (==) :: NonNullType -> NonNullType -> Bool # (/=) :: NonNullType -> NonNullType -> Bool # | |
Show NonNullType Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> NonNullType -> ShowS # show :: NonNullType -> String # showList :: [NonNullType] -> ShowS # |
data ObjectField Source #
Key-value pair.
A list of ObjectField
s represents a GraphQL object type.
Instances
Eq ObjectField Source # | |
Defined in Language.GraphQL.AST (==) :: ObjectField -> ObjectField -> Bool # (/=) :: ObjectField -> ObjectField -> Bool # | |
Show ObjectField Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> ObjectField -> ShowS # show :: ObjectField -> String # showList :: [ObjectField] -> ShowS # |
data OperationDefinition Source #
Operation definition.
OperationSelectionSet SelectionSet | |
OperationDefinition OperationType (Maybe Name) [VariableDefinition] [Directive] SelectionSet |
Instances
Eq OperationDefinition Source # | |
Defined in Language.GraphQL.AST (==) :: OperationDefinition -> OperationDefinition -> Bool # (/=) :: OperationDefinition -> OperationDefinition -> Bool # | |
Show OperationDefinition Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> OperationDefinition -> ShowS # show :: OperationDefinition -> String # showList :: [OperationDefinition] -> ShowS # |
data OperationType Source #
GraphQL has 3 operation types: queries, mutations and subscribtions.
Currently only queries and mutations are supported.
Instances
Eq OperationType Source # | |
Defined in Language.GraphQL.AST (==) :: OperationType -> OperationType -> Bool # (/=) :: OperationType -> OperationType -> Bool # | |
Show OperationType Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> OperationType -> ShowS # show :: OperationType -> String # showList :: [OperationType] -> ShowS # |
type SelectionSet = NonEmpty Selection Source #
"Top-level" selection, selection on an operation or fragment.
type SelectionSetOpt = [Selection] Source #
Field selection.
Type representation.
type TypeCondition = Name Source #
Type condition.
Input value.
data VariableDefinition Source #
Variable definition.
Instances
Eq VariableDefinition Source # | |
Defined in Language.GraphQL.AST (==) :: VariableDefinition -> VariableDefinition -> Bool # (/=) :: VariableDefinition -> VariableDefinition -> Bool # | |
Show VariableDefinition Source # | |
Defined in Language.GraphQL.AST showsPrec :: Int -> VariableDefinition -> ShowS # show :: VariableDefinition -> String # showList :: [VariableDefinition] -> ShowS # |