| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Language.GraphQL.AST
Description
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 | |
| Show Definition Source # | |
Defined in Language.GraphQL.AST Methods 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.
Constructors
| FragmentDefinition Name TypeCondition [Directive] SelectionSet |
Instances
| Eq FragmentDefinition Source # | |
Defined in Language.GraphQL.AST Methods (==) :: FragmentDefinition -> FragmentDefinition -> Bool # (/=) :: FragmentDefinition -> FragmentDefinition -> Bool # | |
| Show FragmentDefinition Source # | |
Defined in Language.GraphQL.AST Methods showsPrec :: Int -> FragmentDefinition -> ShowS # show :: FragmentDefinition -> String # showList :: [FragmentDefinition] -> ShowS # | |
data FragmentSpread Source #
Fragment spread.
Constructors
| FragmentSpread Name [Directive] |
Instances
| Eq FragmentSpread Source # | |
Defined in Language.GraphQL.AST Methods (==) :: FragmentSpread -> FragmentSpread -> Bool # (/=) :: FragmentSpread -> FragmentSpread -> Bool # | |
| Show FragmentSpread Source # | |
Defined in Language.GraphQL.AST Methods showsPrec :: Int -> FragmentSpread -> ShowS # show :: FragmentSpread -> String # showList :: [FragmentSpread] -> ShowS # | |
data InlineFragment Source #
Inline fragment.
Constructors
| InlineFragment (Maybe TypeCondition) [Directive] SelectionSet |
Instances
| Eq InlineFragment Source # | |
Defined in Language.GraphQL.AST Methods (==) :: InlineFragment -> InlineFragment -> Bool # (/=) :: InlineFragment -> InlineFragment -> Bool # | |
| Show InlineFragment Source # | |
Defined in Language.GraphQL.AST Methods 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.
Constructors
| NonNullTypeNamed Name | |
| NonNullTypeList Type |
Instances
| Eq NonNullType Source # | |
Defined in Language.GraphQL.AST | |
| Show NonNullType Source # | |
Defined in Language.GraphQL.AST Methods showsPrec :: Int -> NonNullType -> ShowS # show :: NonNullType -> String # showList :: [NonNullType] -> ShowS # | |
data ObjectField Source #
Key-value pair.
A list of ObjectFields represents a GraphQL object type.
Constructors
| ObjectField Name Value |
Instances
| Eq ObjectField Source # | |
Defined in Language.GraphQL.AST | |
| Show ObjectField Source # | |
Defined in Language.GraphQL.AST Methods showsPrec :: Int -> ObjectField -> ShowS # show :: ObjectField -> String # showList :: [ObjectField] -> ShowS # | |
data OperationDefinition Source #
Operation definition.
Constructors
| OperationSelectionSet SelectionSet | |
| OperationDefinition OperationType (Maybe Name) [VariableDefinition] [Directive] SelectionSet |
Instances
| Eq OperationDefinition Source # | |
Defined in Language.GraphQL.AST Methods (==) :: OperationDefinition -> OperationDefinition -> Bool # (/=) :: OperationDefinition -> OperationDefinition -> Bool # | |
| Show OperationDefinition Source # | |
Defined in Language.GraphQL.AST Methods 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 Methods (==) :: OperationType -> OperationType -> Bool # (/=) :: OperationType -> OperationType -> Bool # | |
| Show OperationType Source # | |
Defined in Language.GraphQL.AST Methods showsPrec :: Int -> OperationType -> ShowS # show :: OperationType -> String # showList :: [OperationType] -> ShowS # | |
Single selection element.
Constructors
| SelectionField Field | |
| SelectionFragmentSpread FragmentSpread | |
| SelectionInlineFragment InlineFragment |
type SelectionSet = NonEmpty Selection Source #
"Top-level" selection, selection on an operation or fragment.
type SelectionSetOpt = [Selection] Source #
Field selection.
Type representation.
Constructors
| TypeNamed Name | |
| TypeList Type | |
| TypeNonNull NonNullType |
type TypeCondition = Name Source #
Type condition.
Input value.
data VariableDefinition Source #
Variable definition.
Constructors
| VariableDefinition Name Type (Maybe Value) |
Instances
| Eq VariableDefinition Source # | |
Defined in Language.GraphQL.AST Methods (==) :: VariableDefinition -> VariableDefinition -> Bool # (/=) :: VariableDefinition -> VariableDefinition -> Bool # | |
| Show VariableDefinition Source # | |
Defined in Language.GraphQL.AST Methods showsPrec :: Int -> VariableDefinition -> ShowS # show :: VariableDefinition -> String # showList :: [VariableDefinition] -> ShowS # | |