aboutsummaryrefslogtreecommitdiff
path: root/src/Language/GraphQL.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Language/GraphQL.hs')
-rw-r--r--src/Language/GraphQL.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Language/GraphQL.hs b/src/Language/GraphQL.hs
index afce8aa..73f9bdc 100644
--- a/src/Language/GraphQL.hs
+++ b/src/Language/GraphQL.hs
@@ -4,10 +4,10 @@ module Language.GraphQL
, graphqlSubs
) where
-import Control.Monad.IO.Class (MonadIO)
import qualified Data.Aeson as Aeson
import Data.List.NonEmpty (NonEmpty)
-import qualified Data.Text as T
+import Data.HashMap.Strict (HashMap)
+import Data.Text (Text)
import Language.GraphQL.Error
import Language.GraphQL.Execute
import Language.GraphQL.AST.Parser
@@ -16,19 +16,19 @@ import Text.Megaparsec (parse)
-- | If the text parses correctly as a @GraphQL@ query the query is
-- executed using the given 'Schema.Resolver's.
-graphql :: MonadIO m
- => NonEmpty (Schema.Resolver m) -- ^ Resolvers.
- -> T.Text -- ^ Text representing a @GraphQL@ request document.
+graphql :: Monad m
+ => HashMap Text (NonEmpty (Schema.Resolver m)) -- ^ Resolvers.
+ -> Text -- ^ Text representing a @GraphQL@ request document.
-> m Aeson.Value -- ^ Response.
-graphql = flip graphqlSubs $ const Nothing
+graphql = flip graphqlSubs mempty
-- | If the text parses correctly as a @GraphQL@ query the substitution is
-- applied to the query and the query is then executed using to the given
-- 'Schema.Resolver's.
-graphqlSubs :: MonadIO m
- => NonEmpty (Schema.Resolver m) -- ^ Resolvers.
+graphqlSubs :: Monad m
+ => HashMap Text (NonEmpty (Schema.Resolver m)) -- ^ Resolvers.
-> Schema.Subs -- ^ Variable substitution function.
- -> T.Text -- ^ Text representing a @GraphQL@ request document.
+ -> Text -- ^ Text representing a @GraphQL@ request document.
-> m Aeson.Value -- ^ Response.
graphqlSubs schema f
= either parseError (execute schema f)