summaryrefslogtreecommitdiff
path: root/Data/GraphQL/AST/Core.hs
blob: 2ca3928cafa0ed468c3b4818e720aebce6e7ab2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)