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.
This commit is contained in:
Danny Navarro
2017-01-28 14:15:14 -03:00
parent 3e991adf4e
commit 5390c4ca1e
9 changed files with 281 additions and 287 deletions

View File

@ -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)