on master help sign in
Check for empty array/object values (oops!)

Well, that was embarrassing - my rewrite wasn't quite as clever as I thought! This fix drops peak throughput, but it's still better than it was.

commitd58a68447e513bea15c42c5265c76fc325e26885 authorBryan O'Sullivan <bos@serpentine.com> dateTue 26 Nov 2013, 22:40 (13 years ago) parentb8be2ae
1 file changed+5−1
Data/Aeson/Parser/Internal.hs+5−1
Data/Aeson/Parser/Internal.hs+5−1
@@ -117,7 +117,11 @@ array_' = {-# SCC "array_'" #-} do
117117 return (Array vals)
118118
119119commaSeparated :: Parser a -> Word8 -> Parser [a]
120−commaSeparated item endByte = loop
120+commaSeparated item endByte = do
121+ w <- A.peekWord8'
122+ if w == endByte
123+ then A.anyWord8 >> return []
124+ else loop
121125 where
122126 loop = do
123127 v <- item <* skipSpace