summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Language/GraphQL.hs')
-rw-r--r--src/Language/GraphQL.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Language/GraphQL.hs b/src/Language/GraphQL.hs
index 8ed29cf..74052d9 100644
--- a/src/Language/GraphQL.hs
+++ b/src/Language/GraphQL.hs
@@ -1,8 +1,7 @@
-- | This module provides the functions to parse and execute @GraphQL@ queries.
module Language.GraphQL where
-import Control.Monad (MonadPlus)
-
+import Control.Monad.IO.Class (MonadIO)
import qualified Data.Text as T
import qualified Data.Aeson as Aeson
@@ -21,7 +20,7 @@ import Language.GraphQL.Error
-- executed according to the given 'Schema'.
--
-- Returns the response as an @Aeson.@'Aeson.Value'.
-graphql :: MonadPlus m => Schema m -> T.Text -> m Aeson.Value
+graphql :: MonadIO m => Schema m -> T.Text -> m Aeson.Value
graphql = flip graphqlSubs $ const Nothing
-- | Takes a 'Schema', a variable substitution function and text
@@ -30,7 +29,7 @@ graphql = flip graphqlSubs $ const Nothing
-- query and the query is then executed according to the given 'Schema'.
--
-- Returns the response as an @Aeson.@'Aeson.Value'.
-graphqlSubs :: MonadPlus m => Schema m -> Subs -> T.Text -> m Aeson.Value
+graphqlSubs :: MonadIO m => Schema m -> Subs -> T.Text -> m Aeson.Value
graphqlSubs schema f =
either (parseError . errorBundlePretty) (execute schema f)
. parse document ""