{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Language.GraphQL.AST.Parser
( document
) where
import Control.Applicative (Alternative(..), liftA2, optional)
import Control.Applicative.Combinators (sepBy1)
import qualified Control.Applicative.Combinators.NonEmpty as NonEmpty
import Data.List.NonEmpty (NonEmpty(..))
import Data.Text (Text)
import qualified Language.GraphQL.AST.DirectiveLocation as Directive
import Language.GraphQL.AST.DirectiveLocation (DirectiveLocation)
import qualified Language.GraphQL.AST.Document as Full
import Language.GraphQL.AST.Lexer
import Text.Megaparsec
( MonadParsec(..)
, SourcePos(..)
, getSourcePos
, lookAhead
, option
, try
, unPos
, (<?>)
)
document :: Parser Full.Document
document :: Parser Document
document = ParsecT Void Text Identity ()
unicodeBOM
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ParsecT Void Text Identity ()
spaceConsumer
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> forall a. Parser a -> Parser a
lexeme (forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Definition
definition)
definition :: Parser Full.Definition
definition :: Parser Definition
definition = ExecutableDefinition -> Definition
Full.ExecutableDefinition forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ExecutableDefinition
executableDefinition
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Definition
typeSystemDefinition'
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Definition
typeSystemExtension'
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Definition"
where
typeSystemDefinition' :: Parser Definition
typeSystemDefinition' = do
Location
location <- Parser Location
getLocation
TypeSystemDefinition
definition' <- Parser TypeSystemDefinition
typeSystemDefinition
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ TypeSystemDefinition -> Location -> Definition
Full.TypeSystemDefinition TypeSystemDefinition
definition' Location
location
typeSystemExtension' :: Parser Definition
typeSystemExtension' = do
Location
location <- Parser Location
getLocation
TypeSystemExtension
definition' <- Parser TypeSystemExtension
typeSystemExtension
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ TypeSystemExtension -> Location -> Definition
Full.TypeSystemExtension TypeSystemExtension
definition' Location
location
getLocation :: Parser Full.Location
getLocation :: Parser Location
getLocation = SourcePos -> Location
fromSourcePosition forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall s e (m :: * -> *).
(TraversableStream s, MonadParsec e s m) =>
m SourcePos
getSourcePos
where
fromSourcePosition :: SourcePos -> Location
fromSourcePosition SourcePos{String
Pos
sourceName :: SourcePos -> String
sourceLine :: SourcePos -> Pos
sourceColumn :: SourcePos -> Pos
sourceColumn :: Pos
sourceLine :: Pos
sourceName :: String
..} =
Word -> Word -> Location
Full.Location (Pos -> Word
wordFromPosition Pos
sourceLine) (Pos -> Word
wordFromPosition Pos
sourceColumn)
wordFromPosition :: Pos -> Word
wordFromPosition = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pos -> Int
unPos
executableDefinition :: Parser Full.ExecutableDefinition
executableDefinition :: Parser ExecutableDefinition
executableDefinition = OperationDefinition -> ExecutableDefinition
Full.DefinitionOperation forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser OperationDefinition
operationDefinition
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> FragmentDefinition -> ExecutableDefinition
Full.DefinitionFragment forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser FragmentDefinition
fragmentDefinition
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"ExecutableDefinition"
typeSystemDefinition :: Parser Full.TypeSystemDefinition
typeSystemDefinition :: Parser TypeSystemDefinition
typeSystemDefinition = Parser TypeSystemDefinition
schemaDefinition
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TypeSystemDefinition
typeSystemDefinitionWithDescription
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"TypeSystemDefinition"
where
typeSystemDefinitionWithDescription :: Parser TypeSystemDefinition
typeSystemDefinitionWithDescription = Parser Description
description
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
(<|>) Description -> Parser TypeSystemDefinition
typeDefinition' Description -> Parser TypeSystemDefinition
directiveDefinition
typeDefinition' :: Description -> Parser TypeSystemDefinition
typeDefinition' Description
description' = TypeDefinition -> TypeSystemDefinition
Full.TypeDefinition
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Description -> Parser TypeDefinition
typeDefinition Description
description'
typeSystemExtension :: Parser Full.TypeSystemExtension
typeSystemExtension :: Parser TypeSystemExtension
typeSystemExtension = SchemaExtension -> TypeSystemExtension
Full.SchemaExtension forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser SchemaExtension
schemaExtension
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> TypeExtension -> TypeSystemExtension
Full.TypeExtension forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser TypeExtension
typeExtension
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"TypeSystemExtension"
directiveDefinition :: Full.Description -> Parser Full.TypeSystemDefinition
directiveDefinition :: Description -> Parser TypeSystemDefinition
directiveDefinition Description
description' = Description
-> Text
-> ArgumentsDefinition
-> NonEmpty DirectiveLocation
-> TypeSystemDefinition
Full.DirectiveDefinition Description
description'
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"directive"
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Void Text Identity ()
at
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ArgumentsDefinition
argumentsDefinition
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Text -> ParsecT Void Text Identity Text
symbol Text
"on"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (NonEmpty DirectiveLocation)
directiveLocations
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"DirectiveDefinition"
directiveLocations :: Parser (NonEmpty DirectiveLocation)
directiveLocations :: Parser (NonEmpty DirectiveLocation)
directiveLocations = forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ParsecT Void Text Identity Text
pipe
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser DirectiveLocation
directiveLocation forall (m :: * -> *) a sep.
Alternative m =>
m a -> m sep -> m (NonEmpty a)
`NonEmpty.sepBy1` ParsecT Void Text Identity Text
pipe
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"DirectiveLocations"
directiveLocation :: Parser DirectiveLocation
directiveLocation :: Parser DirectiveLocation
directiveLocation = ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e (ExecutableDirectiveLocation
Directive.Query forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"QUERY")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e (ExecutableDirectiveLocation
Directive.Mutation forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"MUTATION")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e (ExecutableDirectiveLocation
Directive.Subscription forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"SUBSCRIPTION")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.FieldDefinition forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"FIELD_DEFINITION")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e (ExecutableDirectiveLocation
Directive.Field forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"FIELD")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e (ExecutableDirectiveLocation
Directive.FragmentDefinition forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Void Text Identity Text
"FRAGMENT_DEFINITION")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e (ExecutableDirectiveLocation
Directive.FragmentSpread forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Void Text Identity Text
"FRAGMENT_SPREAD")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e (ExecutableDirectiveLocation
Directive.InlineFragment forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Void Text Identity Text
"INLINE_FRAGMENT")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.Schema forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"SCHEMA")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.Scalar forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"SCALAR")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.Object forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"OBJECT")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.ArgumentDefinition forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"ARGUMENT_DEFINITION")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.Interface forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"INTERFACE")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.Union forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"UNION")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.EnumValue forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"ENUM_VALUE")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.Enum forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"ENUM")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.InputObject forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"INPUT_OBJECT")
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t (TypeSystemDirectiveLocation
Directive.InputFieldDefinition forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"INPUT_FIELD_DEFINITION")
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"DirectiveLocation"
where
e :: ParsecT Void Text Identity ExecutableDirectiveLocation
-> Parser DirectiveLocation
e = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ExecutableDirectiveLocation -> DirectiveLocation
Directive.ExecutableDirectiveLocation
t :: ParsecT Void Text Identity TypeSystemDirectiveLocation
-> Parser DirectiveLocation
t = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TypeSystemDirectiveLocation -> DirectiveLocation
Directive.TypeSystemDirectiveLocation
typeDefinition :: Full.Description -> Parser Full.TypeDefinition
typeDefinition :: Description -> Parser TypeDefinition
typeDefinition Description
description' = Description -> Parser TypeDefinition
scalarTypeDefinition Description
description'
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Description -> Parser TypeDefinition
objectTypeDefinition Description
description'
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Description -> Parser TypeDefinition
interfaceTypeDefinition Description
description'
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Description -> Parser TypeDefinition
unionTypeDefinition Description
description'
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Description -> Parser TypeDefinition
enumTypeDefinition Description
description'
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Description -> Parser TypeDefinition
inputObjectTypeDefinition Description
description'
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"TypeDefinition"
typeExtension :: Parser Full.TypeExtension
typeExtension :: Parser TypeExtension
typeExtension = Parser TypeExtension
scalarTypeExtension
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TypeExtension
objectTypeExtension
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TypeExtension
interfaceTypeExtension
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TypeExtension
unionTypeExtension
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TypeExtension
enumTypeExtension
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TypeExtension
inputObjectTypeExtension
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"TypeExtension"
scalarTypeDefinition :: Full.Description -> Parser Full.TypeDefinition
scalarTypeDefinition :: Description -> Parser TypeDefinition
scalarTypeDefinition Description
description' = Description -> Text -> [Directive] -> TypeDefinition
Full.ScalarTypeDefinition Description
description'
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"scalar"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"ScalarTypeDefinition"
scalarTypeExtension :: Parser Full.TypeExtension
scalarTypeExtension :: Parser TypeExtension
scalarTypeExtension = forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
extend Text
"scalar" String
"ScalarTypeExtension"
forall a b. (a -> b) -> a -> b
$ (Text -> NonEmpty Directive -> TypeExtension
Full.ScalarTypeExtension forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Directive
directive) forall a. a -> [a] -> NonEmpty a
:| []
objectTypeDefinition :: Full.Description -> Parser Full.TypeDefinition
objectTypeDefinition :: Description -> Parser TypeDefinition
objectTypeDefinition Description
description' = Description
-> Text
-> ImplementsInterfaces []
-> [Directive]
-> [FieldDefinition]
-> TypeDefinition
Full.ObjectTypeDefinition Description
description'
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"type"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => a -> m a -> m a
option (forall (t :: * -> *). t Text -> ImplementsInterfaces t
Full.ImplementsInterfaces []) (forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (ImplementsInterfaces t)
implementsInterfaces forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy1)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parser a -> Parser a
braces (forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser FieldDefinition
fieldDefinition)
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"ObjectTypeDefinition"
objectTypeExtension :: Parser Full.TypeExtension
objectTypeExtension :: Parser TypeExtension
objectTypeExtension = forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
extend Text
"type" String
"ObjectTypeExtension"
forall a b. (a -> b) -> a -> b
$ Parser TypeExtension
fieldsDefinitionExtension forall a. a -> [a] -> NonEmpty a
:|
[ Parser TypeExtension
directivesExtension
, Parser TypeExtension
implementsInterfacesExtension
]
where
fieldsDefinitionExtension :: Parser TypeExtension
fieldsDefinitionExtension = Text
-> ImplementsInterfaces []
-> [Directive]
-> NonEmpty FieldDefinition
-> TypeExtension
Full.ObjectTypeFieldsDefinitionExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => a -> m a -> m a
option (forall (t :: * -> *). t Text -> ImplementsInterfaces t
Full.ImplementsInterfaces []) (forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (ImplementsInterfaces t)
implementsInterfaces forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy1)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parser a -> Parser a
braces (forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser FieldDefinition
fieldDefinition)
directivesExtension :: Parser TypeExtension
directivesExtension = Text
-> ImplementsInterfaces [] -> NonEmpty Directive -> TypeExtension
Full.ObjectTypeDirectivesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => a -> m a -> m a
option (forall (t :: * -> *). t Text -> ImplementsInterfaces t
Full.ImplementsInterfaces []) (forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (ImplementsInterfaces t)
implementsInterfaces forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy1)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Directive
directive
implementsInterfacesExtension :: Parser TypeExtension
implementsInterfacesExtension = Text -> ImplementsInterfaces NonEmpty -> TypeExtension
Full.ObjectTypeImplementsInterfacesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (ImplementsInterfaces t)
implementsInterfaces forall (m :: * -> *) a sep.
Alternative m =>
m a -> m sep -> m (NonEmpty a)
NonEmpty.sepBy1
description :: Parser Full.Description
description :: Parser Description
description = Maybe Text -> Description
Full.Description
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ParsecT Void Text Identity Text
stringValue
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Description"
unionTypeDefinition :: Full.Description -> Parser Full.TypeDefinition
unionTypeDefinition :: Description -> Parser TypeDefinition
unionTypeDefinition Description
description' = Description
-> Text -> [Directive] -> UnionMemberTypes [] -> TypeDefinition
Full.UnionTypeDefinition Description
description'
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"union"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => a -> m a -> m a
option (forall (t :: * -> *). t Text -> UnionMemberTypes t
Full.UnionMemberTypes []) (forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (UnionMemberTypes t)
unionMemberTypes forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy1)
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"UnionTypeDefinition"
unionTypeExtension :: Parser Full.TypeExtension
unionTypeExtension :: Parser TypeExtension
unionTypeExtension = forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
extend Text
"union" String
"UnionTypeExtension"
forall a b. (a -> b) -> a -> b
$ Parser TypeExtension
unionMemberTypesExtension forall a. a -> [a] -> NonEmpty a
:| [Parser TypeExtension
directivesExtension]
where
unionMemberTypesExtension :: Parser TypeExtension
unionMemberTypesExtension = Text -> [Directive] -> UnionMemberTypes NonEmpty -> TypeExtension
Full.UnionTypeUnionMemberTypesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (UnionMemberTypes t)
unionMemberTypes forall (m :: * -> *) a sep.
Alternative m =>
m a -> m sep -> m (NonEmpty a)
NonEmpty.sepBy1
directivesExtension :: Parser TypeExtension
directivesExtension = Text -> NonEmpty Directive -> TypeExtension
Full.UnionTypeDirectivesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Directive
directive
unionMemberTypes ::
Foldable t =>
(Parser Text -> Parser Text -> Parser (t Full.NamedType)) ->
Parser (Full.UnionMemberTypes t)
unionMemberTypes :: forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (UnionMemberTypes t)
unionMemberTypes ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text)
sepBy' = forall (t :: * -> *). t Text -> UnionMemberTypes t
Full.UnionMemberTypes
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Void Text Identity Text
equals
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ParsecT Void Text Identity Text
pipe
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text)
`sepBy'` ParsecT Void Text Identity Text
pipe
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"UnionMemberTypes"
interfaceTypeDefinition :: Full.Description -> Parser Full.TypeDefinition
interfaceTypeDefinition :: Description -> Parser TypeDefinition
interfaceTypeDefinition Description
description' = Description
-> Text -> [Directive] -> [FieldDefinition] -> TypeDefinition
Full.InterfaceTypeDefinition Description
description'
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"interface"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parser a -> Parser a
braces (forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser FieldDefinition
fieldDefinition)
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"InterfaceTypeDefinition"
interfaceTypeExtension :: Parser Full.TypeExtension
interfaceTypeExtension :: Parser TypeExtension
interfaceTypeExtension = forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
extend Text
"interface" String
"InterfaceTypeExtension"
forall a b. (a -> b) -> a -> b
$ Parser TypeExtension
fieldsDefinitionExtension forall a. a -> [a] -> NonEmpty a
:| [Parser TypeExtension
directivesExtension]
where
fieldsDefinitionExtension :: Parser TypeExtension
fieldsDefinitionExtension = Text -> [Directive] -> NonEmpty FieldDefinition -> TypeExtension
Full.InterfaceTypeFieldsDefinitionExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parser a -> Parser a
braces (forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser FieldDefinition
fieldDefinition)
directivesExtension :: Parser TypeExtension
directivesExtension = Text -> NonEmpty Directive -> TypeExtension
Full.InterfaceTypeDirectivesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Directive
directive
enumTypeDefinition :: Full.Description -> Parser Full.TypeDefinition
enumTypeDefinition :: Description -> Parser TypeDefinition
enumTypeDefinition Description
description' = Description
-> Text -> [Directive] -> [EnumValueDefinition] -> TypeDefinition
Full.EnumTypeDefinition Description
description'
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"enum"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn forall a. Parser a -> Parser a
braces Parser EnumValueDefinition
enumValueDefinition
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"EnumTypeDefinition"
enumTypeExtension :: Parser Full.TypeExtension
enumTypeExtension :: Parser TypeExtension
enumTypeExtension = forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
extend Text
"enum" String
"EnumTypeExtension"
forall a b. (a -> b) -> a -> b
$ Parser TypeExtension
enumValuesDefinitionExtension forall a. a -> [a] -> NonEmpty a
:| [Parser TypeExtension
directivesExtension]
where
enumValuesDefinitionExtension :: Parser TypeExtension
enumValuesDefinitionExtension = Text
-> [Directive] -> NonEmpty EnumValueDefinition -> TypeExtension
Full.EnumTypeEnumValuesDefinitionExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parser a -> Parser a
braces (forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser EnumValueDefinition
enumValueDefinition)
directivesExtension :: Parser TypeExtension
directivesExtension = Text -> NonEmpty Directive -> TypeExtension
Full.EnumTypeDirectivesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Directive
directive
inputObjectTypeDefinition :: Full.Description -> Parser Full.TypeDefinition
inputObjectTypeDefinition :: Description -> Parser TypeDefinition
inputObjectTypeDefinition Description
description' = Description
-> Text -> [Directive] -> [InputValueDefinition] -> TypeDefinition
Full.InputObjectTypeDefinition Description
description'
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"input"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn forall a. Parser a -> Parser a
braces Parser InputValueDefinition
inputValueDefinition
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"InputObjectTypeDefinition"
inputObjectTypeExtension :: Parser Full.TypeExtension
inputObjectTypeExtension :: Parser TypeExtension
inputObjectTypeExtension = forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
extend Text
"input" String
"InputObjectTypeExtension"
forall a b. (a -> b) -> a -> b
$ Parser TypeExtension
inputFieldsDefinitionExtension forall a. a -> [a] -> NonEmpty a
:| [Parser TypeExtension
directivesExtension]
where
inputFieldsDefinitionExtension :: Parser TypeExtension
inputFieldsDefinitionExtension = Text
-> [Directive] -> NonEmpty InputValueDefinition -> TypeExtension
Full.InputObjectTypeInputFieldsDefinitionExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parser a -> Parser a
braces (forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser InputValueDefinition
inputValueDefinition)
directivesExtension :: Parser TypeExtension
directivesExtension = Text -> NonEmpty Directive -> TypeExtension
Full.InputObjectTypeDirectivesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Directive
directive
enumValueDefinition :: Parser Full.EnumValueDefinition
enumValueDefinition :: Parser EnumValueDefinition
enumValueDefinition = Description -> Text -> [Directive] -> EnumValueDefinition
Full.EnumValueDefinition
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Description
description
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
enumValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"EnumValueDefinition"
implementsInterfaces ::
Foldable t =>
(Parser Text -> Parser Text -> Parser (t Full.NamedType)) ->
Parser (Full.ImplementsInterfaces t)
implementsInterfaces :: forall (t :: * -> *).
Foldable t =>
(ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text))
-> Parser (ImplementsInterfaces t)
implementsInterfaces ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text)
sepBy' = forall (t :: * -> *). t Text -> ImplementsInterfaces t
Full.ImplementsInterfaces
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"implements"
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ParsecT Void Text Identity Text
amp
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name ParsecT Void Text Identity Text
-> ParsecT Void Text Identity Text -> Parser (t Text)
`sepBy'` ParsecT Void Text Identity Text
amp
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"ImplementsInterfaces"
inputValueDefinition :: Parser Full.InputValueDefinition
inputValueDefinition :: Parser InputValueDefinition
inputValueDefinition = Description
-> Text
-> Type
-> Maybe (Node ConstValue)
-> [Directive]
-> InputValueDefinition
Full.InputValueDefinition
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Description
description
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Void Text Identity ()
colon
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Type
type'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe (Node ConstValue))
defaultValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"InputValueDefinition"
argumentsDefinition :: Parser Full.ArgumentsDefinition
argumentsDefinition :: Parser ArgumentsDefinition
argumentsDefinition = [InputValueDefinition] -> ArgumentsDefinition
Full.ArgumentsDefinition
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn forall a. Parser a -> Parser a
parens Parser InputValueDefinition
inputValueDefinition
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"ArgumentsDefinition"
fieldDefinition :: Parser Full.FieldDefinition
fieldDefinition :: Parser FieldDefinition
fieldDefinition = Description
-> Text
-> ArgumentsDefinition
-> Type
-> [Directive]
-> FieldDefinition
Full.FieldDefinition
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Description
description
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ArgumentsDefinition
argumentsDefinition
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Void Text Identity ()
colon
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Type
type'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"FieldDefinition"
schemaDefinition :: Parser Full.TypeSystemDefinition
schemaDefinition :: Parser TypeSystemDefinition
schemaDefinition = [Directive]
-> NonEmpty OperationTypeDefinition -> TypeSystemDefinition
Full.SchemaDefinition
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"schema"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (NonEmpty OperationTypeDefinition)
operationTypeDefinitions
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"SchemaDefinition"
operationTypeDefinitions :: Parser (NonEmpty Full.OperationTypeDefinition)
operationTypeDefinitions :: Parser (NonEmpty OperationTypeDefinition)
operationTypeDefinitions = forall a. Parser a -> Parser a
braces forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser OperationTypeDefinition
operationTypeDefinition
schemaExtension :: Parser Full.SchemaExtension
schemaExtension :: Parser SchemaExtension
schemaExtension = forall a. Text -> String -> NonEmpty (Parser a) -> Parser a
extend Text
"schema" String
"SchemaExtension"
forall a b. (a -> b) -> a -> b
$ Parser SchemaExtension
schemaOperationExtension forall a. a -> [a] -> NonEmpty a
:| [Parser SchemaExtension
directivesExtension]
where
directivesExtension :: Parser SchemaExtension
directivesExtension = NonEmpty Directive -> SchemaExtension
Full.SchemaDirectivesExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Directive
directive
schemaOperationExtension :: Parser SchemaExtension
schemaOperationExtension = [Directive] -> NonEmpty OperationTypeDefinition -> SchemaExtension
Full.SchemaOperationExtension
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser [Directive]
directives
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (NonEmpty OperationTypeDefinition)
operationTypeDefinitions
operationTypeDefinition :: Parser Full.OperationTypeDefinition
operationTypeDefinition :: Parser OperationTypeDefinition
operationTypeDefinition = OperationType -> Text -> OperationTypeDefinition
Full.OperationTypeDefinition
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser OperationType
operationType forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Void Text Identity ()
colon
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Void Text Identity Text
name
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"OperationTypeDefinition"
operationDefinition :: Parser Full.OperationDefinition
operationDefinition :: Parser OperationDefinition
operationDefinition = Parser OperationDefinition
shorthand
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser OperationDefinition
operationDefinition'
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"OperationDefinition"
where
shorthand :: Parser OperationDefinition
shorthand = do
Location
location <- Parser Location
getLocation
SelectionSet
selectionSet' <- Parser SelectionSet
selectionSet
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ SelectionSet -> Location -> OperationDefinition
Full.SelectionSet SelectionSet
selectionSet' Location
location
operationDefinition' :: Parser OperationDefinition
operationDefinition' = do
Location
location <- Parser Location
getLocation
OperationType
operationType' <- Parser OperationType
operationType
Maybe Text
operationName <- forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ParsecT Void Text Identity Text
name
[VariableDefinition]
variableDefinitions' <- Parser [VariableDefinition]
variableDefinitions
[Directive]
directives' <- Parser [Directive]
directives
SelectionSet
selectionSet' <- Parser SelectionSet
selectionSet
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ OperationType
-> Maybe Text
-> [VariableDefinition]
-> [Directive]
-> SelectionSet
-> Location
-> OperationDefinition
Full.OperationDefinition
OperationType
operationType'
Maybe Text
operationName
[VariableDefinition]
variableDefinitions'
[Directive]
directives'
SelectionSet
selectionSet'
Location
location
operationType :: Parser Full.OperationType
operationType :: Parser OperationType
operationType = OperationType
Full.Query forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"query"
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> OperationType
Full.Mutation forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"mutation"
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> OperationType
Full.Subscription forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"subscription"
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"OperationType"
selectionSet :: Parser Full.SelectionSet
selectionSet :: Parser SelectionSet
selectionSet = forall a. Parser a -> Parser a
braces (forall (m :: * -> *) a. Alternative m => m a -> m (NonEmpty a)
NonEmpty.some Parser Selection
selection) forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"SelectionSet"
selectionSetOpt :: Parser Full.SelectionSetOpt
selectionSetOpt :: Parser SelectionSetOpt
selectionSetOpt = forall a. (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn forall a. Parser a -> Parser a
braces Parser Selection
selection forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"SelectionSet"
selection :: Parser Full.Selection
selection :: Parser Selection
selection = Field -> Selection
Full.FieldSelection forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Field
field
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> FragmentSpread -> Selection
Full.FragmentSpreadSelection forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
try Parser FragmentSpread
fragmentSpread
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> InlineFragment -> Selection
Full.InlineFragmentSelection forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser InlineFragment
inlineFragment
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Selection"
field :: Parser Full.Field
field :: Parser Field
field = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"Field" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
Maybe Text
alias' <- forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ParsecT Void Text Identity Text
alias
Text
name' <- ParsecT Void Text Identity Text
name
[Argument]
arguments' <- Parser [Argument]
arguments
[Directive]
directives' <- Parser [Directive]
directives
SelectionSetOpt
selectionSetOpt' <- Parser SelectionSetOpt
selectionSetOpt
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Maybe Text
-> Text
-> [Argument]
-> [Directive]
-> SelectionSetOpt
-> Location
-> Field
Full.Field Maybe Text
alias' Text
name' [Argument]
arguments' [Directive]
directives' SelectionSetOpt
selectionSetOpt' Location
location
alias :: Parser Full.Name
alias :: ParsecT Void Text Identity Text
alias = forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
try (ParsecT Void Text Identity Text
name forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Void Text Identity ()
colon) forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Alias"
arguments :: Parser [Full.Argument]
arguments :: Parser [Argument]
arguments = forall a. (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn forall a. Parser a -> Parser a
parens Parser Argument
argument forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Arguments"
argument :: Parser Full.Argument
argument :: Parser Argument
argument = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"Argument" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
Text
name' <- ParsecT Void Text Identity Text
name
ParsecT Void Text Identity ()
colon
Node Value
value' <- forall a. Parser a -> Parser (Node a)
valueNode Parser Value
value
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Text -> Node Value -> Location -> Argument
Full.Argument Text
name' Node Value
value' Location
location
fragmentSpread :: Parser Full.FragmentSpread
fragmentSpread :: Parser FragmentSpread
fragmentSpread = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"FragmentSpread" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
Text
_ <- ParsecT Void Text Identity Text
spread
Text
fragmentName' <- ParsecT Void Text Identity Text
fragmentName
[Directive]
directives' <- Parser [Directive]
directives
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Text -> [Directive] -> Location -> FragmentSpread
Full.FragmentSpread Text
fragmentName' [Directive]
directives' Location
location
inlineFragment :: Parser Full.InlineFragment
inlineFragment :: Parser InlineFragment
inlineFragment = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"InlineFragment" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
Text
_ <- ParsecT Void Text Identity Text
spread
Maybe Text
typeCondition' <- forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ParsecT Void Text Identity Text
typeCondition
[Directive]
directives' <- Parser [Directive]
directives
SelectionSet
selectionSet' <- Parser SelectionSet
selectionSet
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Maybe Text
-> [Directive] -> SelectionSet -> Location -> InlineFragment
Full.InlineFragment Maybe Text
typeCondition' [Directive]
directives' SelectionSet
selectionSet' Location
location
fragmentDefinition :: Parser Full.FragmentDefinition
fragmentDefinition :: Parser FragmentDefinition
fragmentDefinition = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"FragmentDefinition" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
Text
_ <- Text -> ParsecT Void Text Identity Text
symbol Text
"fragment"
Text
fragmentName' <- ParsecT Void Text Identity Text
name
Text
typeCondition' <- ParsecT Void Text Identity Text
typeCondition
[Directive]
directives' <- Parser [Directive]
directives
SelectionSet
selectionSet' <- Parser SelectionSet
selectionSet
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Text
-> Text
-> [Directive]
-> SelectionSet
-> Location
-> FragmentDefinition
Full.FragmentDefinition
Text
fragmentName' Text
typeCondition' [Directive]
directives' SelectionSet
selectionSet' Location
location
fragmentName :: Parser Full.Name
fragmentName :: ParsecT Void Text Identity Text
fragmentName = forall a. Parser a -> ParsecT Void Text Identity ()
but (Text -> ParsecT Void Text Identity Text
symbol Text
"on") forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ParsecT Void Text Identity Text
name forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"FragmentName"
typeCondition :: Parser Full.TypeCondition
typeCondition :: ParsecT Void Text Identity Text
typeCondition = Text -> ParsecT Void Text Identity Text
symbol Text
"on" forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ParsecT Void Text Identity Text
name forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"TypeCondition"
valueNode :: forall a. Parser a -> Parser (Full.Node a)
valueNode :: forall a. Parser a -> Parser (Node a)
valueNode Parser a
valueParser = do
Location
location <- Parser Location
getLocation
a
value' <- Parser a
valueParser
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> Location -> Node a
Full.Node a
value' Location
location
value :: Parser Full.Value
value :: Parser Value
value = Text -> Value
Full.Variable forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
variable
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Double -> Value
Full.Float forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
try Parser Double
float
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Int32 -> Value
Full.Int forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Integral a => Parser a
integer
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool -> Value
Full.Boolean forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Bool
booleanValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Value
Full.Null forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Void Text Identity Text
nullValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> Value
Full.String forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
stringValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> Value
Full.Enum forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
try ParsecT Void Text Identity Text
enumValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [Node Value] -> Value
Full.List forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Parser a -> Parser a
brackets (forall (f :: * -> *) a. Alternative f => f a -> f [a]
many forall a b. (a -> b) -> a -> b
$ forall a. Parser a -> Parser (Node a)
valueNode Parser Value
value)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [ObjectField Value] -> Value
Full.Object forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Parser a -> Parser a
braces (forall (f :: * -> *) a. Alternative f => f a -> f [a]
many forall a b. (a -> b) -> a -> b
$ forall a. Parser (Node a) -> Parser (ObjectField a)
objectField forall a b. (a -> b) -> a -> b
$ forall a. Parser a -> Parser (Node a)
valueNode Parser Value
value)
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Value"
constValue :: Parser Full.ConstValue
constValue :: Parser ConstValue
constValue = Double -> ConstValue
Full.ConstFloat forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
try Parser Double
float
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Int32 -> ConstValue
Full.ConstInt forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Integral a => Parser a
integer
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool -> ConstValue
Full.ConstBoolean forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Bool
booleanValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ConstValue
Full.ConstNull forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Void Text Identity Text
nullValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> ConstValue
Full.ConstString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
stringValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> ConstValue
Full.ConstEnum forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
try ParsecT Void Text Identity Text
enumValue
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [Node ConstValue] -> ConstValue
Full.ConstList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Parser a -> Parser a
brackets (forall (f :: * -> *) a. Alternative f => f a -> f [a]
many forall a b. (a -> b) -> a -> b
$ forall a. Parser a -> Parser (Node a)
valueNode Parser ConstValue
constValue)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [ObjectField ConstValue] -> ConstValue
Full.ConstObject forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Parser a -> Parser a
braces (forall (f :: * -> *) a. Alternative f => f a -> f [a]
many forall a b. (a -> b) -> a -> b
$ forall a. Parser (Node a) -> Parser (ObjectField a)
objectField forall a b. (a -> b) -> a -> b
$ forall a. Parser a -> Parser (Node a)
valueNode Parser ConstValue
constValue)
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Value"
booleanValue :: Parser Bool
booleanValue :: Parser Bool
booleanValue = Bool
True forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"true"
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool
False forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> ParsecT Void Text Identity Text
symbol Text
"false"
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"BooleanValue"
enumValue :: Parser Full.Name
enumValue :: ParsecT Void Text Identity Text
enumValue = forall a. Parser a -> ParsecT Void Text Identity ()
but (Text -> ParsecT Void Text Identity Text
symbol Text
"true")
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> forall a. Parser a -> ParsecT Void Text Identity ()
but (Text -> ParsecT Void Text Identity Text
symbol Text
"false")
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> forall a. Parser a -> ParsecT Void Text Identity ()
but (Text -> ParsecT Void Text Identity Text
symbol Text
"null")
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ParsecT Void Text Identity Text
name
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"EnumValue"
stringValue :: Parser Text
stringValue :: ParsecT Void Text Identity Text
stringValue = ParsecT Void Text Identity Text
blockString forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Void Text Identity Text
string forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"StringValue"
nullValue :: Parser Text
nullValue :: ParsecT Void Text Identity Text
nullValue = Text -> ParsecT Void Text Identity Text
symbol Text
"null" forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"NullValue"
objectField :: forall a. Parser (Full.Node a) -> Parser (Full.ObjectField a)
objectField :: forall a. Parser (Node a) -> Parser (ObjectField a)
objectField Parser (Node a)
valueParser = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"ObjectField" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
Text
fieldName <- ParsecT Void Text Identity Text
name
ParsecT Void Text Identity ()
colon
Node a
fieldValue <- Parser (Node a)
valueParser
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. Text -> Node a -> Location -> ObjectField a
Full.ObjectField Text
fieldName Node a
fieldValue Location
location
variableDefinitions :: Parser [Full.VariableDefinition]
variableDefinitions :: Parser [VariableDefinition]
variableDefinitions = forall a. (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn forall a. Parser a -> Parser a
parens Parser VariableDefinition
variableDefinition
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"VariableDefinitions"
variableDefinition :: Parser Full.VariableDefinition
variableDefinition :: Parser VariableDefinition
variableDefinition = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"VariableDefinition" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
Text
variableName <- ParsecT Void Text Identity Text
variable
ParsecT Void Text Identity ()
colon
Type
variableType <- Parser Type
type'
Maybe (Node ConstValue)
variableValue <- Parser (Maybe (Node ConstValue))
defaultValue
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Text
-> Type
-> Maybe (Node ConstValue)
-> Location
-> VariableDefinition
Full.VariableDefinition Text
variableName Type
variableType Maybe (Node ConstValue)
variableValue Location
location
variable :: Parser Full.Name
variable :: ParsecT Void Text Identity Text
variable = ParsecT Void Text Identity Text
dollar forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ParsecT Void Text Identity Text
name forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Variable"
defaultValue :: Parser (Maybe (Full.Node Full.ConstValue))
defaultValue :: Parser (Maybe (Node ConstValue))
defaultValue = forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (ParsecT Void Text Identity Text
equals forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> forall a. Parser a -> Parser (Node a)
valueNode Parser ConstValue
constValue) forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"DefaultValue"
type' :: Parser Full.Type
type' :: Parser Type
type' = forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
try (NonNullType -> Type
Full.TypeNonNull forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NonNullType
nonNullType)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type -> Type
Full.TypeList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Parser a -> Parser a
brackets Parser Type
type'
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> Type
Full.TypeNamed forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Type"
nonNullType :: Parser Full.NonNullType
nonNullType :: Parser NonNullType
nonNullType = Text -> NonNullType
Full.NonNullTypeNamed forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Void Text Identity Text
name forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Void Text Identity Text
bang
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type -> NonNullType
Full.NonNullTypeList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Parser a -> Parser a
brackets Parser Type
type' forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Void Text Identity Text
bang
forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"NonNullType"
directives :: Parser [Full.Directive]
directives :: Parser [Directive]
directives = forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser Directive
directive forall e s (m :: * -> *) a.
MonadParsec e s m =>
m a -> String -> m a
<?> String
"Directives"
directive :: Parser Full.Directive
directive :: Parser Directive
directive = forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"Directive" forall a b. (a -> b) -> a -> b
$ do
Location
location <- Parser Location
getLocation
ParsecT Void Text Identity ()
at
Text
directiveName <- ParsecT Void Text Identity Text
name
[Argument]
directiveArguments <- Parser [Argument]
arguments
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Text -> [Argument] -> Location -> Directive
Full.Directive Text
directiveName [Argument]
directiveArguments Location
location
listOptIn :: (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn :: forall a. (Parser [a] -> Parser [a]) -> Parser a -> Parser [a]
listOptIn Parser [a] -> Parser [a]
surround = forall (m :: * -> *) a. Alternative m => a -> m a -> m a
option [] forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser [a] -> Parser [a]
surround forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Alternative f => f a -> f [a]
some
but :: Parser a -> Parser ()
but :: forall a. Parser a -> ParsecT Void Text Identity ()
but Parser a
pn = Bool
False forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ forall e s (m :: * -> *) a. MonadParsec e s m => m a -> m a
lookAhead Parser a
pn forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
True forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Bool
False -> forall (f :: * -> *) a. Alternative f => f a
empty
Bool
True -> forall (f :: * -> *) a. Applicative f => a -> f a
pure ()