From d12577ae717512979c7654191ca65f25fc877907 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 27 May 2020 23:18:35 +0200 Subject: Define resolvers on type fields Returning resolvers from other resolvers isn't supported anymore. Since we have a type system now, we define the resolvers in the object type fields and pass an object with the previous result to them. --- src/Language/GraphQL/AST/Core.hs | 44 ++++------------------------------------ 1 file changed, 4 insertions(+), 40 deletions(-) (limited to 'src/Language/GraphQL/AST/Core.hs') diff --git a/src/Language/GraphQL/AST/Core.hs b/src/Language/GraphQL/AST/Core.hs index 6dcfb81..59d43eb 100644 --- a/src/Language/GraphQL/AST/Core.hs +++ b/src/Language/GraphQL/AST/Core.hs @@ -1,37 +1,15 @@ -- | This is the AST meant to be executed. module Language.GraphQL.AST.Core - ( Alias - , Arguments(..) - , Directive(..) - , Field(..) - , Fragment(..) + ( Arguments(..) , Name - , Operation(..) - , Selection(..) - , TypeCondition ) where import Data.HashMap.Strict (HashMap) -import Data.Sequence (Seq) -import Data.Text (Text) -import Language.GraphQL.AST (Alias, Name, TypeCondition) -import qualified Language.GraphQL.Type.In as In - --- | GraphQL has 3 operation types: queries, mutations and subscribtions. --- --- Currently only queries and mutations are supported. -data Operation - = Query (Maybe Text) (Seq Selection) - | Mutation (Maybe Text) (Seq Selection) - deriving (Eq, Show) - --- | Single GraphQL field. -data Field - = Field (Maybe Alias) Name Arguments (Seq Selection) - deriving (Eq, Show) +import Language.GraphQL.AST (Name) +import Language.GraphQL.Type.Definition -- | Argument list. -newtype Arguments = Arguments (HashMap Name In.Value) +newtype Arguments = Arguments (HashMap Name Value) deriving (Eq, Show) instance Semigroup Arguments where @@ -40,17 +18,3 @@ instance Semigroup Arguments where instance Monoid Arguments where mempty = Arguments mempty --- | Directive. -data Directive = Directive Name Arguments - deriving (Eq, Show) - --- | Represents fragments and inline fragments. -data Fragment - = Fragment TypeCondition (Seq Selection) - deriving (Eq, Show) - --- | Single selection element. -data Selection - = SelectionFragment Fragment - | SelectionField Field - deriving (Eq, Show) -- cgit v1.2.3