on master help sign in
Remove redundant location information in error messages
commite518edc627c0c1ad7770865644c1623e2b2d441b authorlyxia <li-yao.xia@ens.fr> dateFri 20 May 2016, 14:17 (10 years ago) parent973feb4
1 file changed+3−12
Data/Aeson/Types/Instances.hs+3−12
Data/Aeson/Types/Instances.hs+3−12
@@ -1655,10 +1655,7 @@ ifromJSON = iparse parseJSON
16551655(.:) :: (FromJSON a) => Object -> Text -> Parser a
16561656obj .: key = case H.lookup key obj of
16571657 Nothing -> fail $ "key " ++ show key ++ " not present"
1658− Just v -> modifyFailure addKeyName
1659− $ parseJSON v <?> Key key
1660− where
1661− addKeyName = (("failed to parse field " <> unpack key <> ": ") <>)
1658+ Just v -> parseJSON v <?> Key key
16621659{-# INLINE (.:) #-}
16631660
16641661-- | Retrieve the value associated with the given key of an 'Object'.
@@ -1671,10 +1668,7 @@ obj .: key = case H.lookup key obj of
16711668(.:?) :: (FromJSON a) => Object -> Text -> Parser (Maybe a)
16721669obj .:? key = case H.lookup key obj of
16731670 Nothing -> pure Nothing
1674− Just v -> modifyFailure addKeyName
1675− $ parseJSON v <?> Key key
1676− where
1677− addKeyName = (("failed to parse field " <> unpack key <> ": ") <>)
1671+ Just v -> parseJSON v <?> Key key
16781672{-# INLINE (.:?) #-}
16791673
16801674-- | Like '.:?', but the resulting parser will fail,
@@ -1682,10 +1676,7 @@ obj .:? key = case H.lookup key obj of
16821676(.:!) :: (FromJSON a) => Object -> Text -> Parser (Maybe a)
16831677obj .:! key = case H.lookup key obj of
16841678 Nothing -> pure Nothing
1685− Just v -> modifyFailure addKeyName
1686− $ Just <$> parseJSON v <?> Key key
1687− where
1688− addKeyName = (("failed to parse field " <> unpack key <> ": ") <>)
1679+ Just v -> Just <$> parseJSON v <?> Key key
16891680{-# INLINE (.:!) #-}
16901681
16911682-- | Helper for use in combination with '.:?' to provide default