attoparsec-run-0.0.2.0: Conveniently run Attoparsec parsers
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Attoparsec.Run

Synopsis

Documentation

data FinalResult i a Source #

Constructors

FinalResult 

Fields

  • i

    Remaining unparsed input

  • (Either ParseError a)

    Either an error or a successfully parsed value

Instances

Instances details
(Show i, Show a) => Show (FinalResult i a) Source # 
Instance details

Defined in Data.Attoparsec.Run

Methods

showsPrec :: Int -> FinalResult i a -> ShowS #

show :: FinalResult i a -> String #

showList :: [FinalResult i a] -> ShowS #

(Eq i, Eq a) => Eq (FinalResult i a) Source # 
Instance details

Defined in Data.Attoparsec.Run

Methods

(==) :: FinalResult i a -> FinalResult i a -> Bool #

(/=) :: FinalResult i a -> FinalResult i a -> Bool #

(Ord i, Ord a) => Ord (FinalResult i a) Source # 
Instance details

Defined in Data.Attoparsec.Run

Methods

compare :: FinalResult i a -> FinalResult i a -> Ordering #

(<) :: FinalResult i a -> FinalResult i a -> Bool #

(<=) :: FinalResult i a -> FinalResult i a -> Bool #

(>) :: FinalResult i a -> FinalResult i a -> Bool #

(>=) :: FinalResult i a -> FinalResult i a -> Bool #

max :: FinalResult i a -> FinalResult i a -> FinalResult i a #

min :: FinalResult i a -> FinalResult i a -> FinalResult i a #

finalizeResult Source #

Arguments

:: IResult i a

Must be either Done or Fail, not Partial

-> FinalResult i a 

data ParseError Source #

Constructors

ParseError 

Fields

  • [String]

    A list of contexts in which the error occurred

  • String

    The message describing the error, if any

showParseError :: ParseError -> String Source #

Format a parse error in a matter suitable for displaying in log output

data BufferedInput m i Source #

Constructors

BufferedInput 

Fields

  • i

    Initial input

  • (m i)

    Get the next chunk of input, or an empty string if the end of input has been reached

data RestorableInput m i Source #

An effectful source of parser input which supports a "restore" operation that can be used to push unused portions of input back to the source

For an example, see newRestorableIO.

Constructors

RestorableInput 

Fields

  • (m i)

    Get the next chunk of input, or an empty string if the end of input has been reached

  • (i -> m ())

    Restore a non-empty chunk of input to the input stream

newRestorableIO :: IO i -> IO (RestorableInput IO i) Source #

Turn any IO input source into a RestorableInput

Internally, this is backed by an IORef that holds any unparsed remainder.

inputState :: (Monoid i, MonadState [i] m) => RestorableInput m i Source #

A RestorableInput in which getting and restoring are both backed by MonadState operations.