Skip to content
This repository
Browse code

Simplify the definition of modifyFailure

  • Loading branch information...
commit 4e299b658d0f6c5da7cfb33e306ee118ca12f697 1 parent 34d4636
Bryan O'Sullivan authored

Showing 1 changed file with 2 additions and 5 deletions. Show diff stats Hide diff stats

  1. 7  Data/Aeson/Types/Internal.hs
7  Data/Aeson/Types/Internal.hs
@@ -228,7 +228,7 @@ object = Object . H.fromList
228 228
 {-# INLINE object #-}
229 229
 
230 230
 -- | If the inner @Parser@ failed, modify the failure message using the
231  
--- provided function. This allows you to create more meaningful error messages.
  231
+-- provided function. This allows you to create more descriptive error messages.
232 232
 -- For example:
233 233
 --
234 234
 -- > parseJSON (Object o) = modifyFailure
@@ -237,7 +237,4 @@ object = Object . H.fromList
237 237
 --
238 238
 -- Since 0.6.2.0
239 239
 modifyFailure :: (String -> String) -> Parser a -> Parser a
240  
-modifyFailure f (Parser p) =
241  
-    Parser $ \failure success -> p (modifyFailure' failure) success
242  
-  where
243  
-    modifyFailure' failure original = failure $ f original
  240
+modifyFailure f (Parser p) = Parser $ \kf -> p (kf . f)

0 notes on commit 4e299b6

Please sign in to comment.
Something went wrong with that request. Please try again.