From 8efb08fda157770afb836537b27c2cd55042b706 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 5 Jan 2020 07:42:04 +0100 Subject: Parse ObjectDefinition --- src/Language/GraphQL/AST/Document.hs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/Language/GraphQL/AST/Document.hs') 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) -- cgit v1.2.3