summaryrefslogtreecommitdiff
path: root/Data/GraphQL/Schema.hs
blob: 8d4e1d61339fc730be11ca3babbd2dc823ecb07d (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
32
33
34
35
36
module Data.GraphQL.Schema where

import Data.Text (Text)
import Data.HashMap.Lazy (HashMap)

data Schema f = Schema (QueryRoot f) (Maybe (MutationRoot f))

type QueryRoot f = Object f

type MutationRoot f = Object f

type Object f = HashMap Text (Input -> f Output)

type ObjectInput =  HashMap Text Input

data Output = OutputScalar Scalar
            | OutputObject (HashMap Text Output)
            | OutputUnion [Output]
            | OutputEnum Scalar
            | OutputList [Output]
            | OutputNonNull Output
            | InputError

data Input = InputScalar Scalar
           | InputObject ObjectInput
           | InputEnum Scalar
           | InputList [Output]
           | InputNonNull Input

data Scalar = ScalarInt Int
            | ScalarFloat Double
            | ScalarString Text
            | ScalarBool Bool
            | ScalarID Text

newtype Interface f = Interface (Object f)