pipes-attoparsec-0.3.1: Attoparsec and Pipes integration.

Safe HaskellNone

Pipes.Attoparsec.Internal

Contents

Description

This module provides low-level integration with Attoparsec and is likely to be modified in backwards-incompatible ways in the future.

Use the stable API exported by the Pipes.Attoparsec module instead.

Synopsis

Types

data ParsingError Source

A parsing error report, as provided by Attoparsec's Fail.

Constructors

ParsingError 

Fields

peContexts :: [String]

Contexts where the parsing error occurred.

peMessage :: String

Parsing error description message.

class (Eq a, Monoid a) => ParserInput a Source

A class for valid Attoparsec input types: strict Text and strict ByteString.

Parsing

parseWithDrawSource

Arguments

:: (Monad m, ParserInput a) 
=> Parser a b

Parser to run on the given input

-> StateT (Producer a m r) m (Either ParsingError (Int, b), Maybe a)

Either a parser error or a pair of a result and the parsed input length, as well as an any leftovers.

Run a parser drawing input from the underlying Producer.

parseWithRawSource

Arguments

:: (Monad m, ParserInput a) 
=> m a

An action that will be executed to provide the parser with more input as needed. If the action returns mempty, then it's assumed no more input is available.

-> Parser a r

Parser to run on the given input

-> m (Either ParsingError (Int, r), Maybe a)

Either a parser error or a pair of a result and the parsed input length, as well as an any leftovers.

Run a parser drawing input from the given monadic action as needed.