summaryrefslogtreecommitdiff
path: root/Data/GraphQL/Schema.hs
blob: 37938eea04e24dcd4d0e2be5905ee466641f3e3b (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
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 = Map f

type MutationRoot f = Map f

type Map f = HashMap Text (Resolver f)

type Resolver f = Input -> Output f

data Output f = OutputScalar (f Scalar)
              | OutputMap (Map f)
              | OutputUnion [Map f]
              | OutputEnum (f Scalar)
              | OutputList [Output f]
              | OutputNonNull (Output f)
              | InputError

data Input = InputScalar Scalar
           | InputEnum Scalar
           | InputList [Input]
           | InputNonNull Input

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