Permalink
Browse files

Simplify the value parser

If we've already peeked at a byte, we don't need to check its value
a second time.
  • Loading branch information...
1 parent 0ad96ed commit ce36f2230f72579d305b3310a92d75ce01604261 @bos committed Nov 27, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 Data/Aeson/Parser/Internal.hs
@@ -166,9 +166,9 @@ value :: Parser Value
value = do
w <- A.peekWord8'
case w of
- DOUBLE_QUOTE -> char '"' *> (String <$> jstring_)
- OPEN_CURLY -> char '{' *> object_
- OPEN_SQUARE -> char '[' *> array_
+ DOUBLE_QUOTE -> A.anyWord8 *> (String <$> jstring_)
+ OPEN_CURLY -> A.anyWord8 *> object_
+ OPEN_SQUARE -> A.anyWord8 *> array_
C_f -> string "false" *> pure (Bool False)
C_t -> string "true" *> pure (Bool True)
C_n -> string "null" *> pure Null

0 comments on commit ce36f22

Please sign in to comment.