summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-02-20 05:16:14 +0100
committerEugen Wissner <belka@caraus.de>2020-02-20 05:16:14 +0100
commit613e929d91dfc46ecfc5e28479098ce52aeb56f6 (patch)
tree0a2ebcb1ab4e4f071f536fd372c3a7d3c685d31e /src
parentc0e5e30e76789522097480313230574376bb4271 (diff)
downloadgraphql-613e929d91dfc46ecfc5e28479098ce52aeb56f6.tar.gz
Update to Stack 15.x
Diffstat (limited to 'src')
-rw-r--r--src/Language/GraphQL/AST/Encoder.hs1
-rw-r--r--src/Language/GraphQL/Error.hs21
2 files changed, 12 insertions, 10 deletions
diff --git a/src/Language/GraphQL/AST/Encoder.hs b/src/Language/GraphQL/AST/Encoder.hs
index eb865c9..9b293bf 100644
--- a/src/Language/GraphQL/AST/Encoder.hs
+++ b/src/Language/GraphQL/AST/Encoder.hs
@@ -15,7 +15,6 @@ module Language.GraphQL.AST.Encoder
import Data.Char (ord)
import Data.Foldable (fold)
-import Data.Monoid ((<>))
import qualified Data.List.NonEmpty as NonEmpty
import Data.Text (Text)
import qualified Data.Text as Text
diff --git a/src/Language/GraphQL/Error.hs b/src/Language/GraphQL/Error.hs
index 41a2a9c..91911b7 100644
--- a/src/Language/GraphQL/Error.hs
+++ b/src/Language/GraphQL/Error.hs
@@ -20,18 +20,20 @@ import Control.Monad.Trans.State ( StateT
, modify
, runStateT
)
-import Text.Megaparsec ( ParseErrorBundle(..)
- , SourcePos(..)
- , errorOffset
- , parseErrorTextPretty
- , reachOffset
- , unPos
- )
+import Text.Megaparsec
+ ( ParseErrorBundle(..)
+ , PosState(..)
+ , SourcePos(..)
+ , errorOffset
+ , parseErrorTextPretty
+ , reachOffset
+ , unPos
+ )
-- | Wraps a parse error into a list of errors.
parseError :: Applicative f => ParseErrorBundle Text Void -> f Aeson.Value
parseError ParseErrorBundle{..} =
- pure $ Aeson.object [("errors", Aeson.toJSON $ fst $ foldl go ([], bundlePosState) bundleErrors)]
+ pure $ Aeson.object [("errors", Aeson.toJSON $ fst $ foldl go ([], bundlePosState) bundleErrors)]
where
errorObject s SourcePos{..} = Aeson.object
[ ("message", Aeson.toJSON $ init $ parseErrorTextPretty s)
@@ -39,7 +41,8 @@ parseError ParseErrorBundle{..} =
, ("column", Aeson.toJSON $ unPos sourceColumn)
]
go (result, state) x =
- let (sourcePosition, _, newState) = reachOffset (errorOffset x) state
+ let (_, newState) = reachOffset (errorOffset x) state
+ sourcePosition = pstateSourcePos newState
in (errorObject x sourcePosition : result, newState)
-- | A wrapper to pass error messages around.