From 693b7d18dcd48525b10ce297f89b3b33fd020784 Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Sun, 29 Jan 2017 18:44:03 -0300 Subject: Introduce Tranform module In the Transform module the Full AST will converted to Core AST. This commit also includes a partial implementation of Fragment replacement. --- Data/GraphQL/Execute.hs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'Data/GraphQL/Execute.hs') diff --git a/Data/GraphQL/Execute.hs b/Data/GraphQL/Execute.hs index 561bf20..869753a 100644 --- a/Data/GraphQL/Execute.hs +++ b/Data/GraphQL/Execute.hs @@ -10,17 +10,10 @@ import qualified Data.Aeson as Aeson import qualified Data.GraphQL.AST as AST import qualified Data.GraphQL.AST.Core as AST.Core +import qualified Data.GraphQL.AST.Transform as Transform import Data.GraphQL.Schema (Schema) import qualified Data.GraphQL.Schema as Schema - - -core :: Schema.Subs -> AST.Document -> AST.Core.Document -core subs ((AST.DefinitionOperation opDef) :| []) = error "Not implemented yet" -core _ ((AST.DefinitionFragment fragDef) :| []) = - error "Fragment definitions not supported yet" -core _ _ = error "Multiple definitions not supported yet" - -- | Takes a 'Schema', a variable substitution function ('Schema.Subs'), and a -- @GraphQL@ 'document'. The substitution is applied to the document using -- 'rootFields', and the 'Schema''s resolvers are applied to the resulting fields. @@ -30,7 +23,7 @@ core _ _ = error "Multiple definitions not supported yet" execute :: Alternative f => Schema f -> Schema.Subs -> AST.Document -> f Aeson.Value -execute schema subs doc = document schema $ core subs doc +execute schema subs doc = document schema $ Transform.document subs doc document :: Alternative f => Schema f -> AST.Core.Document -> f Aeson.Value document schema (op :| [])= operation schema op -- cgit v1.2.3