Merge pull request #168 from mkscrg/decodeStrict-fix
Fix "incomplete input" from decodeStrictWith
commitfdf7209833b9a4fa9bf1aba43a758964ccb6b1fb
authorBryan O'Sullivan <bos@serpentine.com>
dateThu 2 Jan 2014, 14:20 (13 years ago)
parent1a2a0db7060052
Data/Aeson/Parser/Internal.hs+3−5
@@ -279,11 +279,9 @@ decodeWith p to s =
279279decodeStrictWith :: Parser Value -> (Value -> Result a) -> B.ByteString
280280 -> Maybe a
281281decodeStrictWith p to s =
282− case A.parse p s of
283− A.Done _ v -> case to v of
284− Success a -> Just a
285− _ -> Nothing
286− _ -> Nothing
282+ case either Error to (A.parseOnly p s) of
283+ Success a -> Just a
284+ Error _ -> Nothing
287285{-# INLINE decodeStrictWith #-}
288286
289287eitherDecodeWith :: Parser Value -> (Value -> Result a) -> L.ByteString