summaryrefslogtreecommitdiff
path: root/Data/GraphQL/AST/Core.hs
diff options
context:
space:
mode:
authorDanny Navarro <j@dannynavarro.net>2017-01-28 14:15:14 -0300
committerDanny Navarro <j@dannynavarro.net>2017-01-28 14:15:14 -0300
commit5390c4ca1e7e6bcf36dbe5e773c1355dd4b65939 (patch)
treedfe1dcc13bacd0a52dd376504bf9caa574631d04 /Data/GraphQL/AST/Core.hs
parent3e991adf4eaeac4da4d074992a507d651b81733f (diff)
downloadgraphql-5390c4ca1e7e6bcf36dbe5e773c1355dd4b65939.tar.gz
Split AST in 2
One AST is meant to be a target parser and tries to adhere as much as possible to the spec. The other is a simplified version of that AST meant for execution. Also newtypes have been replaced by type synonyms and NonEmpty lists are being used where it makes sense.
Diffstat (limited to 'Data/GraphQL/AST/Core.hs')
-rw-r--r--Data/GraphQL/AST/Core.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Data/GraphQL/AST/Core.hs b/Data/GraphQL/AST/Core.hs
index 2ca3928..b5698c6 100644
--- a/Data/GraphQL/AST/Core.hs
+++ b/Data/GraphQL/AST/Core.hs
@@ -6,15 +6,17 @@ import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text)
-newtype Name = Name Text deriving (Eq,Show)
+type Name = Text
-newtype Document = Document (NonEmpty Operation) deriving (Eq,Show)
+type Document = NonEmpty Operation
-data Operation = Query (NonEmpty Field)
+data Operation = Query (NonEmpty Field)
| Mutation (NonEmpty Field)
deriving (Eq,Show)
-data Field = Field Name [Argument] [Field] deriving (Eq,Show)
+data Field = Field (Maybe Alias) Name [Argument] [Field] deriving (Eq,Show)
+
+type Alias = Name
data Argument = Argument Name Value deriving (Eq,Show)