summaryrefslogtreecommitdiff
path: root/Data/GraphQL.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Data/GraphQL.hs')
-rw-r--r--Data/GraphQL.hs25
1 files changed, 12 insertions, 13 deletions
diff --git a/Data/GraphQL.hs b/Data/GraphQL.hs
index a5dac4d..dfe9362 100644
--- a/Data/GraphQL.hs
+++ b/Data/GraphQL.hs
@@ -1,6 +1,4 @@
--- | The module Data.GraphQl provides the
--- functions graphql and graphqlSubs to parse
--- and execute GraphQL queries.
+-- | This module provides the functions to parse and execute @GraphQL@ queries.
module Data.GraphQL where
import Control.Applicative (Alternative)
@@ -16,19 +14,20 @@ import Data.GraphQL.Schema
import Data.GraphQL.Error
--- | graphql takes a schema and text representing a GraphQL request document.
--- If the text parses correctly as a GraphQl query
--- the query is executed according to the given schema.
--- Returns the response to the query wrapped in an Aeson.Value.
+-- | Takes a 'Schema' and text representing a @GraphQL@ request document.
+-- If the text parses correctly as a @GraphQL@ query the query is
+-- executed according to the given 'Schema'.
+--
+-- Returns the response as an @Aeson.@'Aeson.Value'.
graphql :: (Alternative m, Monad m) => Schema m -> Text -> m Aeson.Value
graphql = flip graphqlSubs $ const Nothing
--- | graphqlsubs takes in a schema, a substitution and text representing
--- a GraphQL request document.
--- If the text parses correctly as a GraphQl query
--- the substitution is applied to the query and
--- the query is then executed according to the given schema.
--- Returns the response to the query wrapped in an Aeson.Value.
+-- | Takes a 'Schema', a variable substitution function and text
+-- representing a @GraphQL@ request document. If the text parses
+-- correctly as a @GraphQL@ query the substitution is applied to the
+-- query and the query is then executed according to the given 'Schema'.
+--
+-- Returns the response as an @Aeson.@'Aeson.Value'.
graphqlSubs :: (Alternative m, Monad m) => Schema m -> Subs -> Text -> m Aeson.Value
graphqlSubs schema f =
either parseError (execute schema f)