Fix "incomplete input" from decodeStrictWith
commit7060052eeb2ffdd2b91d3673ceea4e1da52e1f49
authorMike Craig <mkscrg@gmail.com>
dateMon 25 Nov 2013, 15:07 (13 years ago)
parentbf766b4
Data/Aeson/Parser/Internal.hs+3−5
@@ -259,11 +259,9 @@ decodeWith p to s =
259259decodeStrictWith :: Parser Value -> (Value -> Result a) -> B.ByteString
260260 -> Maybe a
261261decodeStrictWith p to s =
262− case A.parse p s of
263− A.Done _ v -> case to v of
264− Success a -> Just a
265− _ -> Nothing
266− _ -> Nothing
262+ case either Error to (A.parseOnly p s) of
263+ Success a -> Just a
264+ Error _ -> Nothing
267265{-# INLINE decodeStrictWith #-}
268266
269267eitherDecodeWith :: Parser Value -> (Value -> Result a) -> L.ByteString