aboutsummaryrefslogtreecommitdiff
path: root/Data/GraphQL/AST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Data/GraphQL/AST.hs')
-rw-r--r--Data/GraphQL/AST.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/Data/GraphQL/AST.hs b/Data/GraphQL/AST.hs
index 0a09671..cc631e6 100644
--- a/Data/GraphQL/AST.hs
+++ b/Data/GraphQL/AST.hs
@@ -1,5 +1,6 @@
module Data.GraphQL.AST where
+import Data.Int (Int32)
import Data.Text (Text)
-- * Name
@@ -15,12 +16,12 @@ data Definition = DefinitionOperation OperationDefinition
| DefinitionType TypeDefinition
deriving (Eq,Show)
-data OperationDefinition =
- Query Name [VariableDefinition] [Directive] SelectionSet
- | Mutation Name [VariableDefinition] [Directive] SelectionSet
- -- Not official yet
- -- -- | Subscription Name [VariableDefinition] [Directive] SelectionSet
- deriving (Eq,Show)
+data OperationDefinition = Query Node
+ | Mutation Node
+ deriving (Eq,Show)
+
+data Node = Node Name [VariableDefinition] [Directive] SelectionSet
+ deriving (Eq,Show)
data VariableDefinition = VariableDefinition Variable Type (Maybe DefaultValue)
deriving (Eq,Show)
@@ -61,15 +62,18 @@ type TypeCondition = NamedType
-- * Values
data Value = ValueVariable Variable
- | ValueInt Int -- TODO: Should this be `Integer`?
- | ValueFloat Double -- TODO: Should this be `Scientific`?
+ | ValueInt Int32
+ -- GraphQL Float is double precison
+ | ValueFloat Double
| ValueBoolean Bool
- | ValueString Text
+ | ValueString StringValue
| ValueEnum Name
| ValueList ListValue
| ValueObject ObjectValue
deriving (Eq,Show)
+newtype StringValue = StringValue Text deriving (Eq,Show)
+
newtype ListValue = ListValue [Value] deriving (Eq,Show)
newtype ObjectValue = ObjectValue [ObjectField] deriving (Eq,Show)