summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/AST/Document.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-01-05 07:42:04 +0100
committerEugen Wissner <belka@caraus.de>2020-01-13 08:21:02 +0100
commit8efb08fda157770afb836537b27c2cd55042b706 (patch)
treea4207ea264e5268c8c840ffb471b56d7d9687ec5 /src/Language/GraphQL/AST/Document.hs
parentd9a2937b55b3f9c55ac42b1968b62888d916dace (diff)
downloadgraphql-8efb08fda157770afb836537b27c2cd55042b706.tar.gz
Parse ObjectDefinition
Diffstat (limited to 'src/Language/GraphQL/AST/Document.hs')
-rw-r--r--src/Language/GraphQL/AST/Document.hs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/Language/GraphQL/AST/Document.hs b/src/Language/GraphQL/AST/Document.hs
index 30ec897..619a6f3 100644
--- a/src/Language/GraphQL/AST/Document.hs
+++ b/src/Language/GraphQL/AST/Document.hs
@@ -5,11 +5,17 @@
module Language.GraphQL.AST.Document
( Alias
, Argument(..)
+ , ArgumentsDefinition(..)
, Definition(ExecutableDefinition, TypeSystemDefinition)
+ , Description(..)
, Directive(..)
, Document
, ExecutableDefinition(..)
+ , FieldDefinition(..)
, FragmentDefinition(..)
+ , ImplementsInterfaces(..)
+ , ImplementsInterfacesOpt(..)
+ , InputValueDefinition(..)
, Name
, NonNullType(..)
, ObjectField(..)
@@ -22,6 +28,7 @@ module Language.GraphQL.AST.Document
, SelectionSetOpt
, Type(..)
, TypeCondition
+ , TypeDefinition(..)
, TypeSystemDefinition(..)
, Value(..)
, VariableDefinition(..)
@@ -302,13 +309,27 @@ newtype ImplementsInterfaces = ImplementsInterfaces (NonEmpty NamedType)
newtype ImplementsInterfacesOpt = ImplementsInterfacesOpt [NamedType]
deriving (Eq, Show)
+instance Semigroup ImplementsInterfacesOpt where
+ (ImplementsInterfacesOpt xs) <> (ImplementsInterfacesOpt ys) =
+ ImplementsInterfacesOpt $ xs <> ys
+
+instance Monoid ImplementsInterfacesOpt where
+ mempty = ImplementsInterfacesOpt []
+
data FieldDefinition
- = FieldDefinition Description Name ArgumentsDefinition Type
+ = FieldDefinition Description Name ArgumentsDefinition Type [Directive]
deriving (Eq, Show)
newtype ArgumentsDefinition = ArgumentsDefinition [InputValueDefinition]
deriving (Eq, Show)
+instance Semigroup ArgumentsDefinition where
+ (ArgumentsDefinition xs) <> (ArgumentsDefinition ys) =
+ ArgumentsDefinition $ xs <> ys
+
+instance Monoid ArgumentsDefinition where
+ mempty = ArgumentsDefinition []
+
data InputValueDefinition
= InputValueDefinition Description Name Type (Maybe Value) [Directive]
deriving (Eq, Show)