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


-- | Pass input from an enumerator to an Attoparsec parser.
--   
--   This library allows an Attoparsec parser to receive input
--   incrementally from an enumerator. This could be used for parsing large
--   files, or implementing binary network protocols.
--   
--   <pre>
--   (-# LANGUAGE OverloadedStrings #-)
--   
--   import Control.Applicative
--   import Data.Attoparsec
--   import Data.Attoparsec.Enumerator
--   import Data.Enumerator
--   import Data.Enumerator.Binary (enumHandle)
--   import Data.Enumerator.List
--   import System.IO
--   
--   parser = string "foo" &lt;|&gt; string "bar"
--   
--   main = do
--       xy &lt;- run_ (enumHandle 1 stdin $$ do
--           x &lt;- iterParser parser
--           y &lt;- iterParser parser
--           return (x, y))
--       print xy
--   </pre>
@package attoparsec-enumerator
@version 0.3.3


module Data.Attoparsec.Enumerator

-- | The context and message from a <a>Fail</a> value.
data ParseError
ParseError :: [String] -> String -> ParseError
errorContexts :: ParseError -> [String]
errorMessage :: ParseError -> String

-- | A class of types which may be consumed by an Attoparsec parser.
--   
--   Since: 0.3
class AttoparsecInput a

-- | Convert an Attoparsec <a>Parser</a> into an <a>Iteratee</a>. The
--   parser will be streamed bytes until it returns <a>Done</a> or
--   <a>Fail</a>.
--   
--   If parsing fails, a <a>ParseError</a> will be thrown with
--   <a>throwError</a>. Use <a>catchError</a> to catch it.
iterParser :: (AttoparsecInput a, Monad m) => Parser a b -> Iteratee a m b
instance Typeable ParseError
instance Show ParseError
instance AttoparsecInput Text
instance AttoparsecInput ByteString
instance Exception ParseError
