summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/AST
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-05-27 23:18:35 +0200
committerEugen Wissner <belka@caraus.de>2020-05-29 13:53:51 +0200
commitd12577ae717512979c7654191ca65f25fc877907 (patch)
tree17eda8d92d92ef2773c439d614f00ea0e74ea969 /src/Language/GraphQL/AST
parentc06d0b8e95ea4b87eab69da085cb32dbd052c1f0 (diff)
downloadgraphql-d12577ae717512979c7654191ca65f25fc877907.tar.gz
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.
Diffstat (limited to 'src/Language/GraphQL/AST')
-rw-r--r--src/Language/GraphQL/AST/Core.hs44
1 files changed, 4 insertions, 40 deletions
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)