From 44dc80bb37558fc6a35b22791ac407b63956176d Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 30 Dec 2019 18:26:24 +0100 Subject: Replace substitution function with a map It makes using variables with queries more approachable, but some work still has to be done. - The type `Subs` should be renamed and moved out of `Schema`, together with `AST.Core.Value` probably. - Some kind of conversion should be possible from a user-defined input type T to the Value. So the final HashMap should have a type like `HashMap name a`, where a is an instance of a potential typeclass InputType. --- src/Language/GraphQL/Schema.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Language/GraphQL/Schema.hs') diff --git a/src/Language/GraphQL/Schema.hs b/src/Language/GraphQL/Schema.hs index fa8bf78..facf722 100644 --- a/src/Language/GraphQL/Schema.hs +++ b/src/Language/GraphQL/Schema.hs @@ -44,8 +44,9 @@ data Resolver m = Resolver Text -- ^ Name (Field -> CollectErrsT m Aeson.Object) -- ^ Resolver --- | Variable substitution function. -type Subs = Name -> Maybe Value +-- | Contains variables for the query. The key of the map is a variable name, +-- and the value is the variable value. +type Subs = HashMap Name Value -- | Create a new 'Resolver' with the given 'Name' from the given 'Resolver's. object :: MonadIO m => Name -> ActionT m [Resolver m] -> Resolver m -- cgit v1.2.3