Commits

Bryan O'Sullivan committed efea142

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.

  • Participants
  • Parent commits 9a433f9

Comments (0)

Files changed (1)

File Data/Aeson/Parser/Internal.hs

   return (Array vals)
 
 commaSeparated :: Parser a -> Word8 -> Parser [a]
-commaSeparated item endByte = loop
+commaSeparated item endByte = do
+  w <- A.peekWord8'
+  if w == endByte
+    then A.anyWord8 >> return []
+    else loop
   where
     loop = do
       v <- item <* skipSpace