mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 04:51:35 +03:00
975b022b29
This reduces the usage of "utils" modules in the parsers code, especially those that are simply re-exported from elsewhere, to facilitate extracting the parsers code into its own library. It mostly inlines the imports that are re-exported from `Hasura.Prelude` and `Data.Parser.JSONPath`. It also removes references to `Data.*.Extended` modules. When necessary, it re-implements the functionality (which is typically trivial). It does not tackle all external dependencies. I observed the following that will take more work: - `Data.GADT.Compare.Extended` - `Data.Text.Extended` - `Hasura.Base.Error` - `Hasura.RQL.Types.Common` - `Hasura.Server.Utils` PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4964 GitOrigin-RevId: 54ad3c1b7a31f13e34340ebe9fcc36d0ad57b8bd
24 lines
681 B
Haskell
24 lines
681 B
Haskell
-- | Classes for monads used during schema construction and query parsing.
|
|
module Hasura.GraphQL.Parser.Class.Parse
|
|
( MonadParse (..),
|
|
parseError,
|
|
)
|
|
where
|
|
|
|
import Data.Aeson.Types (JSONPathElement)
|
|
import Data.Text (Text)
|
|
import Hasura.Base.Error
|
|
import 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
|