on master help sign in
Simplify the definition of modifyFailure
commit9fd2493b2bf6a5c9a0c2da4ba12514553770ce70 authorBryan O'Sullivan <bos@serpentine.com> dateWed 2 Jan 2013, 09:05 (14 years ago) parent7bfbda7
1 file changed+2−5
Data/Aeson/Types/Internal.hs+2−5
Data/Aeson/Types/Internal.hs+2−5
@@ -228,7 +228,7 @@ object = Object . H.fromList
228228{-# INLINE object #-}
229229
230230-- | 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.
232232-- For example:
233233--
234234-- > parseJSON (Object o) = modifyFailure
@@ -237,7 +237,4 @@ object = Object . H.fromList
237237--
238238-- Since 0.6.2.0
239239modifyFailure :: (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)