2017-01-26 23:52:07 +01:00
|
|
|
-- | 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)
|
|
|
|
|
2017-01-28 18:15:14 +01:00
|
|
|
type Name = Text
|
2017-01-26 23:52:07 +01:00
|
|
|
|
2017-01-28 18:15:14 +01:00
|
|
|
type Document = NonEmpty Operation
|
2017-01-26 23:52:07 +01:00
|
|
|
|
2017-01-28 18:15:14 +01:00
|
|
|
data Operation = Query (NonEmpty Field)
|
2017-01-26 23:52:07 +01:00
|
|
|
| Mutation (NonEmpty Field)
|
|
|
|
deriving (Eq,Show)
|
|
|
|
|
2017-01-28 18:15:14 +01:00
|
|
|
data Field = Field (Maybe Alias) Name [Argument] [Field] deriving (Eq,Show)
|
|
|
|
|
|
|
|
type Alias = Name
|
2017-01-26 23:52:07 +01:00
|
|
|
|
|
|
|
data Argument = Argument Name Value deriving (Eq,Show)
|
|
|
|
|
|
|
|
data Value = ValueInt Int32
|
|
|
|
-- GraphQL Float is double precision
|
|
|
|
| ValueFloat Double
|
|
|
|
| ValueString Text
|
2017-01-29 22:44:03 +01:00
|
|
|
| ValueBoolean Bool
|
|
|
|
| ValueNull
|
2017-01-26 23:52:07 +01:00
|
|
|
| ValueEnum Name
|
|
|
|
| ValueList [Value]
|
|
|
|
| ValueObject [ObjectField]
|
|
|
|
deriving (Eq,Show)
|
|
|
|
|
|
|
|
data ObjectField = ObjectField Name Value deriving (Eq,Show)
|