-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Incremental applicative JSON parser -- @package json-stream @version 0.1.0.0 -- | An incremental applicative-style JSON parser, suitable for high -- performance memory efficient stream parsing. -- -- The parser is using Data.Aeson types and FromJSON -- instance, it can be easily combined with aeson monadic parsing -- instances when appropriate. module Data.JsonStream.Parser -- | A representation of the parser. data Parser a -- | Result of parsing. Contains continuations to continue parsing. data ParseOutput a -- | Returns a value from a parser. ParseYield :: a -> (ParseOutput a) -> ParseOutput a -- | Parser needs more data to continue parsing. ParseNeedData :: (ByteString -> ParseOutput a) -> ParseOutput a -- | Parsing failed, error is reported. ParseFailed :: String -> ParseOutput a -- | Parsing finished, unparsed data is returned. ParseDone :: ByteString -> ParseOutput a -- | Run streaming parser, immediately returns ParseNeedData. runParser :: Parser a -> ParseOutput a -- | Run streaming parser with initial input. runParser' :: Parser a -> ByteString -> ParseOutput a -- | Parse a bytestring, generate lazy list of parsed values. If an error -- occurs, throws an exception. parseByteString :: Parser a -> ByteString -> [a] -- | Parse a lazy bytestring, generate lazy list of parsed values. If an -- error occurs, throws an exception. parseLazyByteString :: Parser a -> ByteString -> [a] -- | Match FromJSON value. value :: FromJSON a => Parser a -- | Match only specific key of an object. objectWithKey :: Text -> Parser a -> Parser a -- | Match all key-value pairs of an object, return them as a tuple. objectItems :: Parser a -> Parser (Text, a) -- | Match all key-value pairs of an object, return only values. objectValues :: Parser a -> Parser a -- | Match all items of an array. array :: Parser a -> Parser a -- | Match n'th item of an array. arrayWithIndex :: Int -> Parser a -> Parser a -- | Match all items of an array, add index to output. indexedArray :: Parser a -> Parser (Int, a) -- | Let only items matching a condition pass filterI :: (a -> Bool) -> Parser a -> Parser a -- | Fetch yields of a function and return them as list. toList :: Parser a -> Parser [a] -- | Returns a value if none is found upstream. defaultValue :: a -> Parser a -> Parser a -- | Catch an error in underlying parser. catchFail :: Parser a -> Parser a instance Alternative Parser instance Applicative Parser instance Functor Parser instance Functor ParseResult