{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Data.Morpheus.Parsing.Internal.Arguments (maybeArguments) where
import Data.Morpheus.Parsing.Internal.Internal
( Parser,
getLocation,
)
import Data.Morpheus.Parsing.Internal.Terms
( colon,
parseName,
uniqTupleOpt,
)
import Data.Morpheus.Parsing.Internal.Value
( Parse (..),
)
import Data.Morpheus.Types.Internal.AST
( Argument (..),
Arguments,
Value,
)
import Relude
import Text.Megaparsec (label)
valueArgument :: Parse (Value s) => Parser (Argument s)
valueArgument :: forall (s :: Stage). Parse (Value s) => Parser (Argument s)
valueArgument =
forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"Argument" forall a b. (a -> b) -> a -> b
$
forall (valid :: Stage).
Position -> FieldName -> Value valid -> Argument valid
Argument
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Position
getLocation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (t :: NAME). Parser (Name t)
parseName forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser ()
colon)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parse a => Parser a
parse
{-# INLINEABLE valueArgument #-}
maybeArguments :: Parse (Value s) => Parser (Arguments s)
maybeArguments :: forall (s :: Stage). Parse (Value s) => Parser (Arguments s)
maybeArguments =
forall e s (m :: * -> *) a.
MonadParsec e s m =>
String -> m a -> m a
label String
"Arguments" forall a b. (a -> b) -> a -> b
$
forall (map :: * -> * -> *) k a.
(FromList GQLResult map k a, Empty (map k a), KeyOf k a) =>
Parser a -> Parser (map k a)
uniqTupleOpt forall (s :: Stage). Parse (Value s) => Parser (Argument s)
valueArgument
{-# INLINEABLE maybeArguments #-}