From 5390c4ca1e7e6bcf36dbe5e773c1355dd4b65939 Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Sat, 28 Jan 2017 14:15:14 -0300 Subject: 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. --- Data/GraphQL/AST/Core.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Data/GraphQL/AST') 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) -- cgit v1.2.3