Commits

Bryan O'Sullivan committed 623f804

Small cleanups.

Comments (0)

Files changed (1)

Data/Aeson/Parser.hs

 
 json :: Parser Value
 json = do
-  skipSpace
-  c <- anyChar
+  c <- skipSpace *> anyChar
   case c of
-    '{' -> skipSpace *> object
-    '[' -> skipSpace *> array
+    '{' -> skipSpace *> object_
+    '[' -> skipSpace *> array_
     _   -> fail "root value is not an object or array"
 
-object :: Parser Value
-object = do
+object_ :: Parser Value
+object_ = do
   let pair = liftA2 (,) (jstring <* skipSpace) (char8 ':' *> skipSpace *> value)
-  vals <- (pair <* skipSpace) `sepBy` (char8 ',' *> skipSpace)
-  _ <- char8 '}'
+  vals <- ((pair <* skipSpace) `sepBy` (char8 ',' *> skipSpace)) <* char8 '}'
   return . Object $ Map.fromList vals
 
-array :: Parser Value
-array = do
-  vals <- (value <* skipSpace) `sepBy` (char8 ',' *> skipSpace)
-  _ <- char8 ']'
+array_ :: Parser Value
+array_ = do
+  vals <- ((value <* skipSpace) `sepBy` (char8 ',' *> skipSpace)) <* char8 ']'
   return . Array $ Vector.fromList vals
 
 value :: Parser Value
   most = do
     c <- anyChar
     case c of
-      '{' -> skipSpace *> object
-      '[' -> skipSpace *> array
+      '{' -> skipSpace *> object_
+      '[' -> skipSpace *> array_
       '"' -> String <$> jstring_
       'f' -> string "alse" *> pure (Bool False)
       't' -> string "rue" *> pure (Bool True)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.