mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 21:12:09 +03:00
e4da80421e
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4815 GitOrigin-RevId: d0d889754944cc8270bdee2fd21b0cf5dcad9175
23 lines
650 B
Haskell
23 lines
650 B
Haskell
-- | Classes for monads used during schema construction and query parsing.
|
|
module Hasura.GraphQL.Parser.Class.Parse
|
|
( MonadParse (..),
|
|
parseError,
|
|
)
|
|
where
|
|
|
|
import Data.Parser.JSONPath
|
|
import Hasura.Base.Error
|
|
import Hasura.Prelude
|
|
|
|
-- | A class that provides functionality for parsing GraphQL queries, i.e.
|
|
-- running a fully-constructed 'Parser'.
|
|
class Monad m => MonadParse m where
|
|
withKey :: JSONPathElement -> m a -> m a
|
|
|
|
-- | Not the full power of 'MonadError' because parse errors cannot be
|
|
-- caught.
|
|
parseErrorWith :: Code -> Text -> m a
|
|
|
|
parseError :: MonadParse m => Text -> m a
|
|
parseError = parseErrorWith ValidationFailed
|