Commits

Bryan O'Sullivan committed 076ac66 Merge

Merge pull request #168 from mkscrg/decodeStrict-fix

Fix "incomplete input" from decodeStrictWith

Comments (0)

Files changed (1)

Data/Aeson/Parser/Internal.hs

 decodeStrictWith :: Parser Value -> (Value -> Result a) -> B.ByteString
                  -> Maybe a
 decodeStrictWith p to s =
-    case A.parse p s of
-      A.Done _ v -> case to v of
-                      Success a -> Just a
-                      _         -> Nothing
-      _          -> Nothing
+    case either Error to (A.parseOnly p s) of
+      Success a -> Just a
+      Error _ -> Nothing
 {-# INLINE decodeStrictWith #-}
 
 eitherDecodeWith :: Parser Value -> (Value -> Result a) -> L.ByteString