@@ -117,6 +117,7 @@ import Control.Applicative ( (<|>), (<$>), pure, (*>), (<*) )
117
117
import Control.Concurrent.MVar (MVar , newMVar )
118
118
import Control.Exception (Exception )
119
119
import qualified Data.Aeson as JSON
120
+ import qualified Data.Aeson.Internal as JSON
120
121
import qualified Data.Aeson.Parser as JSON (value' )
121
122
import Data.Attoparsec.ByteString.Char8 hiding (Result )
122
123
import Data.ByteString (ByteString )
@@ -567,7 +568,7 @@ fromFieldJSONByteString f mbs =
567
568
Just bs -> pure bs
568
569
569
570
-- | Parse a field to a JSON 'JSON.Value' and convert that into a
570
- -- Haskell value using 'JSON.fromJSON' .
571
+ -- Haskell value using the 'JSON.FromJSON' instance .
571
572
--
572
573
-- This can be used as the default implementation for the 'fromField'
573
574
-- method for Haskell types that have a JSON representation in
@@ -588,10 +589,10 @@ fromFieldJSONByteString f mbs =
588
589
fromJSONField :: (JSON. FromJSON a , Typeable a ) => FieldParser a
589
590
fromJSONField f mbBs = do
590
591
value <- fromField f mbBs
591
- case JSON. fromJSON value of
592
- JSON. Error err -> returnError ConversionFailed f $
593
- " JSON decoding error: " ++ err
594
- JSON. Success x -> pure x
592
+ case JSON. ifromJSON value of
593
+ JSON. IError path err -> returnError ConversionFailed f $
594
+ " JSON decoding error: " ++ ( JSON. formatError path err)
595
+ JSON. ISuccess x -> pure x
595
596
596
597
-- | Compatible with the same set of types as @a@. Note that
597
598
-- modifying the 'IORef' does not have any effects outside
0 commit comments