Add Graphql Core AST

This commit is contained in:
Danny Navarro 2017-01-26 19:52:07 -03:00
parent 10fdf05aa7
commit 3e991adf4e
No known key found for this signature in database
GPG Key ID: 81E5F99780FA6A32
1 changed files with 31 additions and 0 deletions

31
Data/GraphQL/AST/Core.hs Normal file
View File

@ -0,0 +1,31 @@
-- | This is the AST meant to be executed.
module Data.GraphQL.AST.Core where
import Data.Int (Int32)
import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text)
newtype Name = Name Text deriving (Eq,Show)
newtype Document = Document (NonEmpty Operation) deriving (Eq,Show)
data Operation = Query (NonEmpty Field)
| Mutation (NonEmpty Field)
deriving (Eq,Show)
data Field = Field Name [Argument] [Field] deriving (Eq,Show)
data Argument = Argument Name Value deriving (Eq,Show)
data Value = ValueInt Int32
-- GraphQL Float is double precision
| ValueFloat Double
| ValueBoolean Bool
| ValueString Text
| ValueEnum Name
| ValueList [Value]
| ValueObject [ObjectField]
deriving (Eq,Show)
data ObjectField = ObjectField Name Value deriving (Eq,Show)