summaryrefslogtreecommitdiff
path: root/Data/GraphQL.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-06-28 11:12:28 +0200
committerEugen Wissner <belka@caraus.de>2019-06-28 11:12:28 +0200
commit79c734fa629f6bb200e2d695200c5ec2967c997f (patch)
treeef8ee586b3161346f64e270fa5e806eb40a9aeb0 /Data/GraphQL.hs
parentae4038eb471030edd7261d04d8f170663475a2b7 (diff)
downloadgraphql-79c734fa629f6bb200e2d695200c5ec2967c997f.tar.gz
Replace Alternative with MonadPlus
Diffstat (limited to 'Data/GraphQL.hs')
-rw-r--r--Data/GraphQL.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Data/GraphQL.hs b/Data/GraphQL.hs
index c332b6c..47ca2b0 100644
--- a/Data/GraphQL.hs
+++ b/Data/GraphQL.hs
@@ -1,7 +1,7 @@
-- | This module provides the functions to parse and execute @GraphQL@ queries.
module Data.GraphQL where
-import Control.Applicative (Alternative)
+import Control.Monad (MonadPlus)
import qualified Data.Text as T
@@ -21,7 +21,7 @@ import Data.GraphQL.Error
-- executed according to the given 'Schema'.
--
-- Returns the response as an @Aeson.@'Aeson.Value'.
-graphql :: (Alternative m, Monad m) => Schema m -> T.Text -> m Aeson.Value
+graphql :: MonadPlus m => Schema m -> T.Text -> m Aeson.Value
graphql = flip graphqlSubs $ const Nothing
-- | Takes a 'Schema', a variable substitution function and text
@@ -30,7 +30,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 :: (Alternative m, Monad m) => Schema m -> Subs -> T.Text -> m Aeson.Value
+graphqlSubs :: MonadPlus m => Schema m -> Subs -> T.Text -> m Aeson.Value
graphqlSubs schema f =
either (parseError . errorBundlePretty) (execute schema f)
. parse document ""