diff options
Diffstat (limited to 'src/Language/GraphQL/AST.hs')
| -rw-r--r-- | src/Language/GraphQL/AST.hs | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/Language/GraphQL/AST.hs b/src/Language/GraphQL/AST.hs index 8f40c10..6794ae3 100644 --- a/src/Language/GraphQL/AST.hs +++ b/src/Language/GraphQL/AST.hs @@ -35,6 +35,7 @@ import Data.List.NonEmpty (NonEmpty) import Data.Text (Text) import Language.GraphQL.AST.Core ( Alias , Name + , TypeCondition ) -- * Document @@ -45,18 +46,20 @@ type Document = NonEmpty Definition -- * Operations -- | Top-level definition of a document, either an operation or a fragment. -data Definition = DefinitionOperation OperationDefinition - | DefinitionFragment FragmentDefinition - deriving (Eq, Show) +data Definition + = DefinitionOperation OperationDefinition + | DefinitionFragment FragmentDefinition + deriving (Eq, Show) -- | Operation definition. -data OperationDefinition = OperationSelectionSet SelectionSet - | OperationDefinition OperationType - (Maybe Name) - VariableDefinitions - Directives - SelectionSet - deriving (Eq, Show) +data OperationDefinition + = OperationSelectionSet SelectionSet + | OperationDefinition OperationType + (Maybe Name) + [VariableDefinition] + [Directive] + SelectionSet + deriving (Eq, Show) -- | GraphQL has 3 operation types: queries, mutations and subscribtions. -- @@ -68,11 +71,12 @@ data OperationType = Query | Mutation deriving (Eq, Show) -- | "Top-level" selection, selection on a operation. type SelectionSet = NonEmpty Selection +-- | Field selection. type SelectionSetOpt = [Selection] -- | Single selection element. data Selection - = SelectionField Field + = SelectionField Field | SelectionFragmentSpread FragmentSpread | SelectionInlineFragment InlineFragment deriving (Eq, Show) @@ -81,12 +85,13 @@ data Selection -- | GraphQL field. data Field - = Field (Maybe Alias) Name Arguments Directives SelectionSetOpt + = Field (Maybe Alias) Name [Argument] [Directive] SelectionSetOpt deriving (Eq, Show) -- * Arguments -- | Argument list. +{-# DEPRECATED Arguments "Use [Argument] instead" #-} type Arguments = [Argument] -- | Argument. @@ -95,23 +100,20 @@ data Argument = Argument Name Value deriving (Eq,Show) -- * Fragments -- | Fragment spread. -data FragmentSpread = FragmentSpread Name Directives deriving (Eq, Show) +data FragmentSpread = FragmentSpread Name [Directive] deriving (Eq, Show) -- | Inline fragment. -data InlineFragment = InlineFragment (Maybe TypeCondition) Directives SelectionSet +data InlineFragment = InlineFragment (Maybe TypeCondition) [Directive] SelectionSet deriving (Eq, Show) -- | Fragment definition. data FragmentDefinition - = FragmentDefinition Name TypeCondition Directives SelectionSet + = FragmentDefinition Name TypeCondition [Directive] SelectionSet deriving (Eq, Show) {-# DEPRECATED FragmentName "Use Name instead" #-} type FragmentName = Name --- | Type condition. -type TypeCondition = Name - -- * Input values -- | Input value. @@ -134,6 +136,7 @@ data ObjectField = ObjectField Name Value deriving (Eq, Show) -- * Variables -- | Variable definition list. +{-# DEPRECATED VariableDefinitions "Use [VariableDefinition] instead" #-} type VariableDefinitions = [VariableDefinition] -- | Variable definition. @@ -157,6 +160,7 @@ data NonNullType = NonNullTypeNamed Name -- * Directives -- | Directive list. +{-# DEPRECATED Directives "Use [Directive] instead" #-} type Directives = [Directive] -- | Directive. |
