-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Attoparsec and Pipes integration.
--   
--   Utilities to run Attoparsec parsers on Pipes input streams.
--   
--   See the changelog.md file in the source distribution to learn
--   about any important changes between version.
@package pipes-attoparsec
@version 0.5.1.2

-- | pipes utilities for incrementally running
--   attoparsec-based parsers.
--   
--   This module assumes familiarity with pipes-parse, you can
--   learn about it in Pipes.Parse.Tutorial.
module Pipes.Attoparsec

-- | Convert an attoparsec Parser to a pipes-parse
--   Parser.
--   
--   This Parser is compatible with the tools from
--   Pipes.Parse.
--   
--   It returns Nothing if the underlying Producer is
--   exhausted, otherwise it attempts to run the given attoparsec
--   Parser on the underlying Producer, possibly failing with
--   ParsingError.
parse :: (Monad m, ParserInput a) => Parser a b -> Parser a m (Maybe (Either ParsingError b))

-- | Convert a producer of ParserInput to a producer of parsed
--   values.
--   
--   This producer returns Right when end-of-input is reached
--   sucessfully, otherwise it returns a ParsingError and the
--   leftovers including the malformed input that couldn't be parsed. You
--   can use errorP to promote the Either return value to an
--   ErrorT monad transformer.
parsed :: (Monad m, ParserInput a) => Parser a b -> Producer a m r -> Producer b m (Either (ParsingError, Producer a m r) r)

-- | Like parse, but also returns the length of input consumed to
--   parse the value.
parseL :: (Monad m, ParserInput a) => Parser a b -> Parser a m (Maybe (Either ParsingError (Int, b)))

-- | Like parsed, except this tags each parsed value with the length
--   of input consumed to parse the value.
parsedL :: (Monad m, ParserInput a) => Parser a b -> Producer a m r -> Producer (Int, b) m (Either (ParsingError, Producer a m r) r)

-- | Like isEndOfInput, except that it also consumes and discards
--   leading empty chunks.
isEndOfParserInput :: (Monad m, ParserInput a) => Parser a m Bool

-- | A class for valid attoparsec input types
class (Eq a, Monoid a) => ParserInput a

-- | A parsing error report, as provided by Attoparsec's Fail.
data ParsingError
ParsingError :: [String] -> String -> ParsingError

-- | Contexts where the parsing error occurred.
[peContexts] :: ParsingError -> [String]

-- | Parsing error description message.
[peMessage] :: ParsingError -> String
instance Data.Data.Data Pipes.Attoparsec.ParsingError
instance GHC.Classes.Eq Pipes.Attoparsec.ParsingError
instance GHC.Read.Read Pipes.Attoparsec.ParsingError
instance GHC.Show.Show Pipes.Attoparsec.ParsingError
instance Pipes.Attoparsec.ParserInput Data.ByteString.Internal.ByteString
instance Pipes.Attoparsec.ParserInput Data.Text.Internal.Text
instance GHC.Exception.Exception Pipes.Attoparsec.ParsingError
instance Control.Monad.Trans.Error.Error Pipes.Attoparsec.ParsingError
instance Control.Monad.Trans.Error.Error (Pipes.Attoparsec.ParsingError, Pipes.Core.Producer a m r)
