diff options
| author | Danny Navarro <j@dannynavarro.net> | 2016-02-15 14:25:15 +0100 |
|---|---|---|
| committer | Danny Navarro <j@dannynavarro.net> | 2016-02-15 14:43:52 +0100 |
| commit | 98d2d41cda148cd086099f3c2c2bc2ba70d9cfba (patch) | |
| tree | c792485bf175d8d068a10996c455b3c574349ca3 /Data/GraphQL.hs | |
| parent | 119f94b38e66f0e321f99b2489c3008e3585d76e (diff) | |
| download | graphql-98d2d41cda148cd086099f3c2c2bc2ba70d9cfba.tar.gz | |
Initial support for variable substitution
The correspondent end-to-end test has been ported. The variable
definition still needs to be checked.
Diffstat (limited to 'Data/GraphQL.hs')
| -rw-r--r-- | Data/GraphQL.hs | 8 |
1 files changed, 6 insertions, 2 deletions
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 |
