summaryrefslogtreecommitdiff
path: root/Data
diff options
context:
space:
mode:
authorDanny Navarro <j@dannynavarro.net>2015-10-17 17:49:56 +0200
committerDanny Navarro <j@dannynavarro.net>2015-10-17 17:49:56 +0200
commit3f30a44d1d9464ec112246c7dae1a5519b39769e (patch)
treeabe32c2c42490130488241435ebe1bfb8ddc3d8d /Data
parent8e3bae4b5c18dd1647e2a1de5c51802531b90ddb (diff)
downloadgraphql-3f30a44d1d9464ec112246c7dae1a5519b39769e.tar.gz
Test fixtures for Schema toplevel
This includes simplications to the Schema data types.
Diffstat (limited to 'Data')
-rw-r--r--Data/GraphQL/Schema.hs39
1 files changed, 12 insertions, 27 deletions
diff --git a/Data/GraphQL/Schema.hs b/Data/GraphQL/Schema.hs
index cfa1c9c..8d4e1d6 100644
--- a/Data/GraphQL/Schema.hs
+++ b/Data/GraphQL/Schema.hs
@@ -3,38 +3,29 @@ module Data.GraphQL.Schema where
import Data.Text (Text)
import Data.HashMap.Lazy (HashMap)
-data Schema = Schema QueryRoot MutationRoot
+data Schema f = Schema (QueryRoot f) (Maybe (MutationRoot f))
-type QueryRoot = ObjectOutput
+type QueryRoot f = Object f
-type MutationRoot = ObjectOutput
+type MutationRoot f = Object f
-type ObjectOutput = HashMap Text Output
+type Object f = HashMap Text (Input -> f 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
+ | OutputObject (HashMap Text Output)
+ | OutputUnion [Output]
| OutputEnum Scalar
- | OutputList List
- | OutputNonNull NonNull
+ | OutputList [Output]
+ | OutputNonNull Output
+ | InputError
data Input = InputScalar Scalar
| InputObject ObjectInput
| InputEnum Scalar
- | InputList List
- | InputNonNull NonNull
+ | InputList [Output]
+ | InputNonNull Input
data Scalar = ScalarInt Int
| ScalarFloat Double
@@ -42,10 +33,4 @@ data Scalar = ScalarInt Int
| ScalarBool Bool
| ScalarID Text
-newtype Interface = Interface (HashMap Text Output)
-
-newtype Union = Union [ObjectOutput]
-
-type List = [Type]
-
-type NonNull = Type
+newtype Interface f = Interface (Object f)