forked from OSS/graphql
5390c4ca1e
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.
34 lines
855 B
Haskell
34 lines
855 B
Haskell
-- | 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)
|
|
|
|
type Name = Text
|
|
|
|
type Document = NonEmpty Operation
|
|
|
|
data Operation = Query (NonEmpty Field)
|
|
| Mutation (NonEmpty 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)
|
|
|
|
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)
|