summaryrefslogtreecommitdiff
path: root/tests/Test/StarWars/Schema.hs
diff options
context:
space:
mode:
authorDanny Navarro <j@dannynavarro.net>2017-01-28 14:15:14 -0300
committerDanny Navarro <j@dannynavarro.net>2017-01-28 14:15:14 -0300
commit5390c4ca1e7e6bcf36dbe5e773c1355dd4b65939 (patch)
treedfe1dcc13bacd0a52dd376504bf9caa574631d04 /tests/Test/StarWars/Schema.hs
parent3e991adf4eaeac4da4d074992a507d651b81733f (diff)
downloadgraphql-5390c4ca1e7e6bcf36dbe5e773c1355dd4b65939.tar.gz
Split AST in 2
One AST is meant to be a target parser and tries to adhere as much as possible to the spec. The other is a simplified version of that AST meant for execution. Also newtypes have been replaced by type synonyms and NonEmpty lists are being used where it makes sense.
Diffstat (limited to 'tests/Test/StarWars/Schema.hs')
-rw-r--r--tests/Test/StarWars/Schema.hs10
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/Test/StarWars/Schema.hs b/tests/Test/StarWars/Schema.hs
index ff79686..29c123e 100644
--- a/tests/Test/StarWars/Schema.hs
+++ b/tests/Test/StarWars/Schema.hs
@@ -1,15 +1,11 @@
-{-# LANGUAGE CPP #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
module Test.StarWars.Schema where
import Control.Applicative (Alternative, empty)
+import Data.List.NonEmpty (NonEmpty((:|)))
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative ((<$>))
-import Data.Traversable (traverse)
-#endif
-import Data.GraphQL.Schema
+import Data.GraphQL.Schema (Schema, Resolver, Argument(..), Value(..))
import qualified Data.GraphQL.Schema as Schema
import Test.StarWars.Data
@@ -18,7 +14,7 @@ import Test.StarWars.Data
-- See https://github.com/graphql/graphql-js/blob/master/src/__tests__/starWarsSchema.js
schema :: Alternative f => Schema f
-schema = Schema [hero, human, droid]
+schema = hero :| [human, droid]
hero :: Alternative f => Resolver f
hero = Schema.objectA "hero" $ \case