Minor adjustments in AST for easier parsing
Also `Maybe` wrappers removed. I don't think there needs to be a special case for empty values vs no values at all.
This commit is contained in:
parent
97b99eb448
commit
44a2ff4765
@ -16,12 +16,13 @@ data Definition = DefinitionOperation OperationDefinition
|
|||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data OperationDefinition =
|
data OperationDefinition =
|
||||||
Query Name (Maybe [VariableDefinition]) (Maybe [Directive]) SelectionSet
|
Query Name [VariableDefinition] [Directive] SelectionSet
|
||||||
| Mutation Name (Maybe [VariableDefinition]) (Maybe [Directive]) SelectionSet
|
| Mutation Name [VariableDefinition] [Directive] SelectionSet
|
||||||
| Subscription Name (Maybe [VariableDefinition]) (Maybe [Directive]) SelectionSet
|
-- Not official yet
|
||||||
|
-- -- | Subscription Name [VariableDefinition] [Directive] SelectionSet
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data VariableDefinition = VariableDefinition Variable Type (Maybe DefaultValue)
|
data VariableDefinition = VariableDefinition Variable Type DefaultValue
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
newtype Variable = Variable Name deriving (Eq,Show)
|
newtype Variable = Variable Name deriving (Eq,Show)
|
||||||
@ -33,9 +34,9 @@ data Selection = SelectionField Field
|
|||||||
| SelectionInlineFragment InlineFragment
|
| SelectionInlineFragment InlineFragment
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data Field = Field (Maybe Alias) Name (Maybe [Argument])
|
data Field = Field Alias Name [Argument]
|
||||||
(Maybe [Directive])
|
[Directive]
|
||||||
(Maybe SelectionSet)
|
SelectionSet
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
type Alias = Name
|
type Alias = Name
|
||||||
@ -44,15 +45,15 @@ data Argument = Argument Name Value deriving (Eq,Show)
|
|||||||
|
|
||||||
-- * Fragments
|
-- * Fragments
|
||||||
|
|
||||||
data FragmentSpread = FragmentSpread Name (Maybe [Directive])
|
data FragmentSpread = FragmentSpread Name [Directive]
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data InlineFragment =
|
data InlineFragment =
|
||||||
InlineFragment TypeCondition (Maybe [Directive]) SelectionSet
|
InlineFragment TypeCondition [Directive] SelectionSet
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data FragmentDefinition =
|
data FragmentDefinition =
|
||||||
FragmentDefinition Name TypeCondition (Maybe [Directive]) SelectionSet
|
FragmentDefinition Name TypeCondition [Directive] SelectionSet
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
type TypeCondition = NamedType
|
type TypeCondition = NamedType
|
||||||
@ -60,10 +61,10 @@ type TypeCondition = NamedType
|
|||||||
-- * Values
|
-- * Values
|
||||||
|
|
||||||
data Value = ValueVariable Variable
|
data Value = ValueVariable Variable
|
||||||
| ValueInt Int
|
| ValueInt Int -- TODO: Should this be `Integer`?
|
||||||
| ValueFloat Float
|
| ValueFloat Double -- TODO: Should this be `Scientific`?
|
||||||
| ValueString Text
|
|
||||||
| ValueBoolean Bool
|
| ValueBoolean Bool
|
||||||
|
| ValueString Text
|
||||||
| ValueEnum Name
|
| ValueEnum Name
|
||||||
| ValueList ListValue
|
| ValueList ListValue
|
||||||
| ValueObject ObjectValue
|
| ValueObject ObjectValue
|
||||||
@ -79,7 +80,7 @@ type DefaultValue = Value
|
|||||||
|
|
||||||
-- * Directives
|
-- * Directives
|
||||||
|
|
||||||
data Directive = Directive Name (Maybe [Argument]) deriving (Eq,Show)
|
data Directive = Directive Name [Argument] deriving (Eq,Show)
|
||||||
|
|
||||||
-- * Type Reference
|
-- * Type Reference
|
||||||
|
|
||||||
@ -107,15 +108,17 @@ data TypeDefinition = TypeDefinitionObject ObjectTypeDefinition
|
|||||||
| TypeDefinitionTypeExtension TypeExtensionDefinition
|
| TypeDefinitionTypeExtension TypeExtensionDefinition
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data ObjectTypeDefinition = ObjectTypeDefinition Name (Maybe Interfaces) [FieldDefinition]
|
data ObjectTypeDefinition = ObjectTypeDefinition Name Interfaces [FieldDefinition]
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
type Interfaces = [NamedType]
|
type Interfaces = [NamedType]
|
||||||
|
|
||||||
data FieldDefinition = FieldDefinition Name [InputValueDefinition]
|
data FieldDefinition = FieldDefinition Name ArgumentsDefinition Type
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data InputValueDefinition = InputValueDefinition Name Type (Maybe DefaultValue)
|
type ArgumentsDefinition = [InputValueDefinition]
|
||||||
|
|
||||||
|
data InputValueDefinition = InputValueDefinition Name Type DefaultValue
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
data InterfaceTypeDefinition = InterfaceTypeDefinition Name [FieldDefinition]
|
data InterfaceTypeDefinition = InterfaceTypeDefinition Name [FieldDefinition]
|
||||||
|
Loading…
Reference in New Issue
Block a user