Skip to content

Commit

Permalink
Doc updates, version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrap committed Apr 21, 2015
1 parent 2a6d221 commit 01012e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Data/JsonStream/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ value = Parser $ \ntok -> loop (callParse aeValue ntok)
AE.Success res -> Yield res (loop np)

-- | Take maximum n matching items.
--
-- > >>> parseByteString (takeI 3 $ arrayOf integer) "[1,2,3,4,5,6,7,8,9,0]" :: [Int]
-- > [1,2,3]
takeI :: Int -> Parser a -> Parser a
takeI num valparse = Parser $ \tok -> loop num (callParse valparse tok)
where
Expand Down Expand Up @@ -490,7 +493,10 @@ toList f = Parser $ \ntok -> loop [] (callParse f ntok)
loop acc (Yield v np) = loop (v:acc) np
loop _ (Failed err) = Failed err

-- | Let only items matching a condition pass
-- | Let only items matching a condition pass.
--
-- > >>> parseByteString (filterI (>5) $ arrayOf integer) "[1,2,3,4,5,6,7,8,9,0]" :: [Int]
-- > [6,7,8,9]
filterI :: (a -> Bool) -> Parser a -> Parser a
filterI cond valparse = Parser $ \ntok -> loop (callParse valparse ntok)
where
Expand Down
2 changes: 1 addition & 1 deletion json-stream.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json-stream
version: 0.2.0.0
version: 0.3.0.0
synopsis: Incremental applicative JSON parser
description: Easy to use JSON parser fully supporting incremental parsing.
Parsing grammar in applicative form.
Expand Down

0 comments on commit 01012e7

Please sign in to comment.