Commits

Bryan O'Sullivan committed e3cdd73

Simplify the definition of modifyFailure

Comments (0)

Files changed (1)

Data/Aeson/Types/Internal.hs

 {-# INLINE object #-}
 
 -- | If the inner @Parser@ failed, modify the failure message using the
--- provided function. This allows you to create more meaningful error messages.
+-- provided function. This allows you to create more descriptive error messages.
 -- For example:
 --
 -- > parseJSON (Object o) = modifyFailure
 --
 -- Since 0.6.2.0
 modifyFailure :: (String -> String) -> Parser a -> Parser a
-modifyFailure f (Parser p) =
-    Parser $ \failure success -> p (modifyFailure' failure) success
-  where
-    modifyFailure' failure original = failure $ f original
+modifyFailure f (Parser p) = Parser $ \kf -> p (kf . f)