summaryrefslogtreecommitdiff
path: root/Data/GraphQL/Schema.hs
diff options
context:
space:
mode:
authorDanny Navarro <j@dannynavarro.net>2015-10-17 13:19:00 +0200
committerDanny Navarro <j@dannynavarro.net>2015-10-17 13:23:49 +0200
commit8e3bae4b5c18dd1647e2a1de5c51802531b90ddb (patch)
treeadf1d7924a5269d943c9bfa2fe79c1b1b7917539 /Data/GraphQL/Schema.hs
parentc8f629e8268cbd54f026b3e3d0765d9cfe655fec (diff)
downloadgraphql-8e3bae4b5c18dd1647e2a1de5c51802531b90ddb.tar.gz
Initial stub for a `GraphQL` and `execute`
Diffstat (limited to 'Data/GraphQL/Schema.hs')
-rw-r--r--Data/GraphQL/Schema.hs51
1 files changed, 51 insertions, 0 deletions
diff --git a/Data/GraphQL/Schema.hs b/Data/GraphQL/Schema.hs
new file mode 100644
index 0000000..cfa1c9c
--- /dev/null
+++ b/Data/GraphQL/Schema.hs
@@ -0,0 +1,51 @@
+module Data.GraphQL.Schema where
+
+import Data.Text (Text)
+import Data.HashMap.Lazy (HashMap)
+
+data Schema = Schema QueryRoot MutationRoot
+
+type QueryRoot = ObjectOutput
+
+type MutationRoot = ObjectOutput
+
+type ObjectOutput = HashMap Text Output
+
+type ObjectInput = HashMap Text Input
+
+data Type = TypeScalar Scalar
+ | TypeOutputObject ObjectOutput
+ | TypeInterface Interface
+ | TypeUnion Union
+ | TypeEnum Scalar
+ | TypeInputObject ObjectInput
+ | TypeList List
+ | TypeNonNull NonNull
+
+data Output = OutputScalar Scalar
+ | OutputObject ObjectOutput
+ | OutputInterface Interface
+ | OutputUnion Union
+ | OutputEnum Scalar
+ | OutputList List
+ | OutputNonNull NonNull
+
+data Input = InputScalar Scalar
+ | InputObject ObjectInput
+ | InputEnum Scalar
+ | InputList List
+ | InputNonNull NonNull
+
+data Scalar = ScalarInt Int
+ | ScalarFloat Double
+ | ScalarString Text
+ | ScalarBool Bool
+ | ScalarID Text
+
+newtype Interface = Interface (HashMap Text Output)
+
+newtype Union = Union [ObjectOutput]
+
+type List = [Type]
+
+type NonNull = Type