From 98d2d41cda148cd086099f3c2c2bc2ba70d9cfba Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Mon, 15 Feb 2016 14:25:15 +0100 Subject: Initial support for variable substitution The correspondent end-to-end test has been ported. The variable definition still needs to be checked. --- Data/GraphQL.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Data/GraphQL.hs') diff --git a/Data/GraphQL.hs b/Data/GraphQL.hs index d18ff2f..2da8a46 100644 --- a/Data/GraphQL.hs +++ b/Data/GraphQL.hs @@ -12,5 +12,9 @@ import Data.GraphQL.Parser import Data.GraphQL.Schema graphql :: (Alternative m, Monad m) => Schema m -> Text -> m Aeson.Value -graphql schema = either (const empty) (execute schema) - . Attoparsec.parseOnly document +graphql = flip graphqlSubs $ const Nothing + +graphqlSubs :: (Alternative m, Monad m) => Schema m -> Subs -> Text -> m Aeson.Value +graphqlSubs schema f = + either (const empty) (execute schema f) + . Attoparsec.parseOnly document -- cgit v1.2.3