input-parsers-0.3.0.2: Extension of the parsers library with more capability and efficiency
Safe HaskellNone
LanguageHaskell2010

Text.Parser.Input

Description

Parsers that can consume and return a prefix of their input.

Synopsis

Documentation

class LookAheadParsing m => InputParsing (m :: Type -> Type) where Source #

Methods for parsing monoidal inputs

Minimal complete definition

getInput, take

Associated Types

type ParserInput (m :: Type -> Type) Source #

The type of the input stream that the parser m expects to parse.

type ParserPosition (m :: Type -> Type) Source #

type ParserPosition (m :: Type -> Type) = Down Int

Methods

getInput :: m (ParserInput m) Source #

Always sucessful parser that returns the entire remaining input without consuming it.

getSourcePos :: m (ParserPosition m) Source #

Retrieve the Position reached by the parser in the input source.

default getSourcePos :: (FactorialMonoid (ParserInput m), Functor m, ParserPosition m ~ Down Int) => m (ParserPosition m) Source #

anyToken :: m (ParserInput m) Source #

A parser that accepts any single atomic prefix of the input stream.

anyToken == satisfy (const True)
anyToken == take 1

take :: Int -> m (ParserInput m) Source #

A parser that accepts exactly the given number of input atoms.

take n == count n anyToken

satisfy :: (ParserInput m -> Bool) -> m (ParserInput m) Source #

A parser that accepts an input atom only if it satisfies the given predicate.

default satisfy :: Monad m => (ParserInput m -> Bool) -> m (ParserInput m) Source #

notSatisfy :: (ParserInput m -> Bool) -> m () Source #

A parser that succeeds exactly when satisfy doesn't, equivalent to notFollowedBy . satisfy

scan :: state -> (state -> ParserInput m -> Maybe state) -> m (ParserInput m) Source #

A stateful scanner. The predicate modifies a state argument, and each transformed state is passed to successive invocations of the predicate on each token of the input until one returns Nothing or the input ends.

This parser does not fail. It will return an empty string if the predicate returns Nothing on the first character.

Note: Because this parser does not fail, do not use it with combinators such as many, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.

default scan :: (Monad m, FactorialMonoid (ParserInput m)) => state -> (state -> ParserInput m -> Maybe state) -> m (ParserInput m) Source #

string :: ParserInput m -> m (ParserInput m) Source #

A parser that consumes and returns the given prefix of the input.

default string :: (Monad m, LeftReductive (ParserInput m), FactorialMonoid (ParserInput m), Show (ParserInput m)) => ParserInput m -> m (ParserInput m) Source #

takeWhile :: (ParserInput m -> Bool) -> m (ParserInput m) Source #

A parser accepting the longest sequence of input atoms that match the given predicate; an optimized version of concat . many . satisfy.

Note: Because this parser does not fail, do not use it with combinators such as many, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.

default takeWhile :: (Monad m, FactorialMonoid (ParserInput m)) => (ParserInput m -> Bool) -> m (ParserInput m) Source #

takeWhile1 :: (ParserInput m -> Bool) -> m (ParserInput m) Source #

A parser accepting the longest non-empty sequence of input atoms that match the given predicate; an optimized version of concat . some . satisfy.

default takeWhile1 :: (Monad m, FactorialMonoid (ParserInput m)) => (ParserInput m -> Bool) -> m (ParserInput m) Source #

Instances

Instances details
InputParsing Parser Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput Parser 
Instance details

Defined in Text.Parser.Input

type ParserInput Parser = ByteString
type ParserPosition Parser 
Instance details

Defined in Text.Parser.Input

type ParserPosition Parser = Down Int
InputParsing Parser Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput Parser 
Instance details

Defined in Text.Parser.Input

type ParserInput Parser = Text
type ParserPosition Parser 
Instance details

Defined in Text.Parser.Input

type ParserPosition Parser = Down Int
InputParsing ReadP Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput ReadP 
Instance details

Defined in Text.Parser.Input

type ParserInput ReadP = String
type ParserPosition ReadP 
Instance details

Defined in Text.Parser.Input

type ParserPosition ReadP = Down Int

Methods

getInput :: ReadP (ParserInput ReadP) Source #

getSourcePos :: ReadP (ParserPosition ReadP) Source #

anyToken :: ReadP (ParserInput ReadP) Source #

take :: Int -> ReadP (ParserInput ReadP) Source #

satisfy :: (ParserInput ReadP -> Bool) -> ReadP (ParserInput ReadP) Source #

notSatisfy :: (ParserInput ReadP -> Bool) -> ReadP () Source #

scan :: state -> (state -> ParserInput ReadP -> Maybe state) -> ReadP (ParserInput ReadP) Source #

string :: ParserInput ReadP -> ReadP (ParserInput ReadP) Source #

takeWhile :: (ParserInput ReadP -> Bool) -> ReadP (ParserInput ReadP) Source #

takeWhile1 :: (ParserInput ReadP -> Bool) -> ReadP (ParserInput ReadP) Source #

InputParsing (Lazy Get) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Lazy Get) 
Instance details

Defined in Text.Parser.Input

type ParserInput (Lazy Get) = ByteString
type ParserPosition (Lazy Get) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (Lazy Get) = Int

Methods

getInput :: Lazy Get (ParserInput (Lazy Get)) Source #

getSourcePos :: Lazy Get (ParserPosition (Lazy Get)) Source #

anyToken :: Lazy Get (ParserInput (Lazy Get)) Source #

take :: Int -> Lazy Get (ParserInput (Lazy Get)) Source #

satisfy :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get (ParserInput (Lazy Get)) Source #

notSatisfy :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get () Source #

scan :: state -> (state -> ParserInput (Lazy Get) -> Maybe state) -> Lazy Get (ParserInput (Lazy Get)) Source #

string :: ParserInput (Lazy Get) -> Lazy Get (ParserInput (Lazy Get)) Source #

takeWhile :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get (ParserInput (Lazy Get)) Source #

takeWhile1 :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get (ParserInput (Lazy Get)) Source #

InputParsing (Strict Get) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Strict Get) 
Instance details

Defined in Text.Parser.Input

type ParserInput (Strict Get) = ByteString
type ParserPosition (Strict Get) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (Strict Get) = Int

Methods

getInput :: Strict Get (ParserInput (Strict Get)) Source #

getSourcePos :: Strict Get (ParserPosition (Strict Get)) Source #

anyToken :: Strict Get (ParserInput (Strict Get)) Source #

take :: Int -> Strict Get (ParserInput (Strict Get)) Source #

satisfy :: (ParserInput (Strict Get) -> Bool) -> Strict Get (ParserInput (Strict Get)) Source #

notSatisfy :: (ParserInput (Strict Get) -> Bool) -> Strict Get () Source #

scan :: state -> (state -> ParserInput (Strict Get) -> Maybe state) -> Strict Get (ParserInput (Strict Get)) Source #

string :: ParserInput (Strict Get) -> Strict Get (ParserInput (Strict Get)) Source #

takeWhile :: (ParserInput (Strict Get) -> Bool) -> Strict Get (ParserInput (Strict Get)) Source #

takeWhile1 :: (ParserInput (Strict Get) -> Bool) -> Strict Get (ParserInput (Strict Get)) Source #

(Monad m, InputParsing m) => InputParsing (IdentityT m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (IdentityT m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (IdentityT m) = ParserInput m
type ParserPosition (IdentityT m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (IdentityT m) = ParserPosition m

Methods

getInput :: IdentityT m (ParserInput (IdentityT m)) Source #

getSourcePos :: IdentityT m (ParserPosition (IdentityT m)) Source #

anyToken :: IdentityT m (ParserInput (IdentityT m)) Source #

take :: Int -> IdentityT m (ParserInput (IdentityT m)) Source #

satisfy :: (ParserInput (IdentityT m) -> Bool) -> IdentityT m (ParserInput (IdentityT m)) Source #

notSatisfy :: (ParserInput (IdentityT m) -> Bool) -> IdentityT m () Source #

scan :: state -> (state -> ParserInput (IdentityT m) -> Maybe state) -> IdentityT m (ParserInput (IdentityT m)) Source #

string :: ParserInput (IdentityT m) -> IdentityT m (ParserInput (IdentityT m)) Source #

takeWhile :: (ParserInput (IdentityT m) -> Bool) -> IdentityT m (ParserInput (IdentityT m)) Source #

takeWhile1 :: (ParserInput (IdentityT m) -> Bool) -> IdentityT m (ParserInput (IdentityT m)) Source #

(MonadPlus m, InputParsing m) => InputParsing (ReaderT e m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (ReaderT e m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (ReaderT e m) = ParserInput m
type ParserPosition (ReaderT e m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (ReaderT e m) = ParserPosition m

Methods

getInput :: ReaderT e m (ParserInput (ReaderT e m)) Source #

getSourcePos :: ReaderT e m (ParserPosition (ReaderT e m)) Source #

anyToken :: ReaderT e m (ParserInput (ReaderT e m)) Source #

take :: Int -> ReaderT e m (ParserInput (ReaderT e m)) Source #

satisfy :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

notSatisfy :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m () Source #

scan :: state -> (state -> ParserInput (ReaderT e m) -> Maybe state) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

string :: ParserInput (ReaderT e m) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

takeWhile :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

takeWhile1 :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

(MonadPlus m, InputParsing m) => InputParsing (StateT s m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (StateT s m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (StateT s m) = ParserInput m
type ParserPosition (StateT s m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (StateT s m) = ParserPosition m

Methods

getInput :: StateT s m (ParserInput (StateT s m)) Source #

getSourcePos :: StateT s m (ParserPosition (StateT s m)) Source #

anyToken :: StateT s m (ParserInput (StateT s m)) Source #

take :: Int -> StateT s m (ParserInput (StateT s m)) Source #

satisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

notSatisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m () Source #

scan :: state -> (state -> ParserInput (StateT s m) -> Maybe state) -> StateT s m (ParserInput (StateT s m)) Source #

string :: ParserInput (StateT s m) -> StateT s m (ParserInput (StateT s m)) Source #

takeWhile :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

takeWhile1 :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

(MonadPlus m, InputParsing m) => InputParsing (StateT s m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (StateT s m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (StateT s m) = ParserInput m
type ParserPosition (StateT s m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (StateT s m) = ParserPosition m

Methods

getInput :: StateT s m (ParserInput (StateT s m)) Source #

getSourcePos :: StateT s m (ParserPosition (StateT s m)) Source #

anyToken :: StateT s m (ParserInput (StateT s m)) Source #

take :: Int -> StateT s m (ParserInput (StateT s m)) Source #

satisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

notSatisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m () Source #

scan :: state -> (state -> ParserInput (StateT s m) -> Maybe state) -> StateT s m (ParserInput (StateT s m)) Source #

string :: ParserInput (StateT s m) -> StateT s m (ParserInput (StateT s m)) Source #

takeWhile :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

takeWhile1 :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (WriterT w m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (WriterT w m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (WriterT w m) = ParserInput m
type ParserPosition (WriterT w m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (WriterT w m) = ParserPosition m

Methods

getInput :: WriterT w m (ParserInput (WriterT w m)) Source #

getSourcePos :: WriterT w m (ParserPosition (WriterT w m)) Source #

anyToken :: WriterT w m (ParserInput (WriterT w m)) Source #

take :: Int -> WriterT w m (ParserInput (WriterT w m)) Source #

satisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

notSatisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m () Source #

scan :: state -> (state -> ParserInput (WriterT w m) -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) Source #

string :: ParserInput (WriterT w m) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeWhile :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeWhile1 :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (WriterT w m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (WriterT w m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (WriterT w m) = ParserInput m
type ParserPosition (WriterT w m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (WriterT w m) = ParserPosition m

Methods

getInput :: WriterT w m (ParserInput (WriterT w m)) Source #

getSourcePos :: WriterT w m (ParserPosition (WriterT w m)) Source #

anyToken :: WriterT w m (ParserInput (WriterT w m)) Source #

take :: Int -> WriterT w m (ParserInput (WriterT w m)) Source #

satisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

notSatisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m () Source #

scan :: state -> (state -> ParserInput (WriterT w m) -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) Source #

string :: ParserInput (WriterT w m) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeWhile :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeWhile1 :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

(FactorialMonoid s, LeftReductive s, Show s, Stream s m t, Show t) => InputParsing (ParsecT s u m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (ParsecT s u m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (ParsecT s u m) = s
type ParserPosition (ParsecT s u m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (ParsecT s u m) = Down Int

Methods

getInput :: ParsecT s u m (ParserInput (ParsecT s u m)) Source #

getSourcePos :: ParsecT s u m (ParserPosition (ParsecT s u m)) Source #

anyToken :: ParsecT s u m (ParserInput (ParsecT s u m)) Source #

take :: Int -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

satisfy :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

notSatisfy :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m () Source #

scan :: state -> (state -> ParserInput (ParsecT s u m) -> Maybe state) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

string :: ParserInput (ParsecT s u m) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

takeWhile :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

takeWhile1 :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (RWST r w s m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (RWST r w s m) = ParserInput m
type ParserPosition (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (RWST r w s m) = ParserPosition m

Methods

getInput :: RWST r w s m (ParserInput (RWST r w s m)) Source #

getSourcePos :: RWST r w s m (ParserPosition (RWST r w s m)) Source #

anyToken :: RWST r w s m (ParserInput (RWST r w s m)) Source #

take :: Int -> RWST r w s m (ParserInput (RWST r w s m)) Source #

satisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

notSatisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m () Source #

scan :: state -> (state -> ParserInput (RWST r w s m) -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

string :: ParserInput (RWST r w s m) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeWhile :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeWhile1 :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (RWST r w s m) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

type ParserInput (RWST r w s m) = ParserInput m
type ParserPosition (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (RWST r w s m) = ParserPosition m

Methods

getInput :: RWST r w s m (ParserInput (RWST r w s m)) Source #

getSourcePos :: RWST r w s m (ParserPosition (RWST r w s m)) Source #

anyToken :: RWST r w s m (ParserInput (RWST r w s m)) Source #

take :: Int -> RWST r w s m (ParserInput (RWST r w s m)) Source #

satisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

notSatisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m () Source #

scan :: state -> (state -> ParserInput (RWST r w s m) -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

string :: ParserInput (RWST r w s m) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeWhile :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeWhile1 :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

class (CharParsing m, InputParsing m) => InputCharParsing (m :: Type -> Type) where Source #

Methods for parsing textual monoid inputs

Minimal complete definition

satisfyCharInput

Methods

satisfyCharInput :: (Char -> Bool) -> m (ParserInput m) Source #

Specialization of satisfy on textual inputs, accepting an input character only if it satisfies the given predicate, and returning the input atom that represents the character. Equivalent to fmap singleton . Char.satisfy

notSatisfyChar :: (Char -> Bool) -> m () Source #

A parser that succeeds exactly when satisfy doesn't, equivalent to notFollowedBy . Char.satisfy

scanChars :: state -> (state -> Char -> Maybe state) -> m (ParserInput m) Source #

Stateful scanner like scan, but specialized for TextualMonoid inputs.

default scanChars :: (Monad m, TextualMonoid (ParserInput m)) => state -> (state -> Char -> Maybe state) -> m (ParserInput m) Source #

takeCharsWhile :: (Char -> Bool) -> m (ParserInput m) Source #

Specialization of takeWhile on TextualMonoid inputs, accepting the longest sequence of input characters that match the given predicate; an optimized version of fmap fromString . many . Char.satisfy.

Note: Because this parser does not fail, do not use it with combinators such as many, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.

default takeCharsWhile :: (Monad m, TextualMonoid (ParserInput m)) => (Char -> Bool) -> m (ParserInput m) Source #

takeCharsWhile1 :: (Char -> Bool) -> m (ParserInput m) Source #

Specialization of takeWhile1 on TextualMonoid inputs, accepting the longest sequence of input characters that match the given predicate; an optimized version of fmap fromString . some . Char.satisfy.

default takeCharsWhile1 :: (Monad m, TextualMonoid (ParserInput m)) => (Char -> Bool) -> m (ParserInput m) Source #

Instances

Instances details
InputCharParsing Parser Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> Parser (ParserInput Parser) Source #

notSatisfyChar :: (Char -> Bool) -> Parser () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser (ParserInput Parser) Source #

takeCharsWhile :: (Char -> Bool) -> Parser (ParserInput Parser) Source #

takeCharsWhile1 :: (Char -> Bool) -> Parser (ParserInput Parser) Source #

InputCharParsing Parser Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> Parser (ParserInput Parser) Source #

notSatisfyChar :: (Char -> Bool) -> Parser () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser (ParserInput Parser) Source #

takeCharsWhile :: (Char -> Bool) -> Parser (ParserInput Parser) Source #

takeCharsWhile1 :: (Char -> Bool) -> Parser (ParserInput Parser) Source #

InputCharParsing ReadP Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> ReadP (ParserInput ReadP) Source #

notSatisfyChar :: (Char -> Bool) -> ReadP () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> ReadP (ParserInput ReadP) Source #

takeCharsWhile :: (Char -> Bool) -> ReadP (ParserInput ReadP) Source #

takeCharsWhile1 :: (Char -> Bool) -> ReadP (ParserInput ReadP) Source #

(MonadPlus m, InputCharParsing m) => InputCharParsing (IdentityT m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> IdentityT m (ParserInput (IdentityT m)) Source #

notSatisfyChar :: (Char -> Bool) -> IdentityT m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> IdentityT m (ParserInput (IdentityT m)) Source #

takeCharsWhile :: (Char -> Bool) -> IdentityT m (ParserInput (IdentityT m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> IdentityT m (ParserInput (IdentityT m)) Source #

(MonadPlus m, InputCharParsing m) => InputCharParsing (ReaderT e m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

notSatisfyChar :: (Char -> Bool) -> ReaderT e m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

takeCharsWhile :: (Char -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) Source #

(MonadPlus m, InputCharParsing m) => InputCharParsing (StateT s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

notSatisfyChar :: (Char -> Bool) -> StateT s m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> StateT s m (ParserInput (StateT s m)) Source #

takeCharsWhile :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

(MonadPlus m, InputCharParsing m) => InputCharParsing (StateT s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

notSatisfyChar :: (Char -> Bool) -> StateT s m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> StateT s m (ParserInput (StateT s m)) Source #

takeCharsWhile :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) Source #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (WriterT w m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

notSatisfyChar :: (Char -> Bool) -> WriterT w m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeCharsWhile :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (WriterT w m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

notSatisfyChar :: (Char -> Bool) -> WriterT w m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeCharsWhile :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) Source #

(TextualMonoid s, Show s, Stream s m Char) => InputCharParsing (ParsecT s u m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

notSatisfyChar :: (Char -> Bool) -> ParsecT s u m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

takeCharsWhile :: (Char -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) Source #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (RWST r w s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

notSatisfyChar :: (Char -> Bool) -> RWST r w s m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeCharsWhile :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (RWST r w s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

notSatisfyChar :: (Char -> Bool) -> RWST r w s m () Source #

scanChars :: state -> (state -> Char -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeCharsWhile :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

takeCharsWhile1 :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) Source #

class InputParsing m => ConsumedInputParsing (m :: Type -> Type) where Source #

Parsers that keep track of the consumed input.

Methods

match :: m a -> m (ParserInput m, a) Source #

Return both the result of a parse and the portion of the input that the argument parser consumed.

Instances

Instances details
ConsumedInputParsing Parser Source # 
Instance details

Defined in Text.Parser.Input

ConsumedInputParsing Parser Source # 
Instance details

Defined in Text.Parser.Input

ConsumedInputParsing ReadP Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: ReadP a -> ReadP (ParserInput ReadP, a) Source #

ConsumedInputParsing (Lazy Get) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: Lazy Get a -> Lazy Get (ParserInput (Lazy Get), a) Source #

ConsumedInputParsing (Strict Get) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: Strict Get a -> Strict Get (ParserInput (Strict Get), a) Source #

(Monad m, ConsumedInputParsing m) => ConsumedInputParsing (IdentityT m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: IdentityT m a -> IdentityT m (ParserInput (IdentityT m), a) Source #

(MonadPlus m, ConsumedInputParsing m) => ConsumedInputParsing (ReaderT e m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: ReaderT e m a -> ReaderT e m (ParserInput (ReaderT e m), a) Source #

(MonadPlus m, ConsumedInputParsing m) => ConsumedInputParsing (StateT s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: StateT s m a -> StateT s m (ParserInput (StateT s m), a) Source #

(MonadPlus m, ConsumedInputParsing m) => ConsumedInputParsing (StateT s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: StateT s m a -> StateT s m (ParserInput (StateT s m), a) Source #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (WriterT w m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: WriterT w m a -> WriterT w m (ParserInput (WriterT w m), a) Source #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (WriterT w m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: WriterT w m a -> WriterT w m (ParserInput (WriterT w m), a) Source #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (RWST r w s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: RWST r w s m a -> RWST r w s m (ParserInput (RWST r w s m), a) Source #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (RWST r w s m) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: RWST r w s m a -> RWST r w s m (ParserInput (RWST r w s m), a) Source #

newtype Lazy (f :: Type -> Type) a Source #

Wrapper that signifies lazy ByteString inputs

Constructors

Lazy 

Fields

Instances

Instances details
Alternative f => Alternative (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

empty :: Lazy f a

(<|>) :: Lazy f a -> Lazy f a -> Lazy f a

some :: Lazy f a -> Lazy f [a] #

many :: Lazy f a -> Lazy f [a] #

Applicative f => Applicative (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

pure :: a -> Lazy f a

(<*>) :: Lazy f (a -> b) -> Lazy f a -> Lazy f b

liftA2 :: (a -> b -> c) -> Lazy f a -> Lazy f b -> Lazy f c

(*>) :: Lazy f a -> Lazy f b -> Lazy f b

(<*) :: Lazy f a -> Lazy f b -> Lazy f a

Functor f => Functor (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

fmap :: (a -> b) -> Lazy f a -> Lazy f b

(<$) :: a -> Lazy f b -> Lazy f a

Monad f => Monad (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

(>>=) :: Lazy f a -> (a -> Lazy f b) -> Lazy f b

(>>) :: Lazy f a -> Lazy f b -> Lazy f b

return :: a -> Lazy f a

MonadPlus f => MonadPlus (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

mzero :: Lazy f a

mplus :: Lazy f a -> Lazy f a -> Lazy f a

DeterministicParsing (Lazy Get) Source # 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: Lazy Get a -> Lazy Get a -> Lazy Get a Source #

takeOptional :: Lazy Get a -> Lazy Get (Maybe a) Source #

takeMany :: Lazy Get a -> Lazy Get [a] Source #

takeSome :: Lazy Get a -> Lazy Get [a] Source #

concatAll :: Monoid a => Lazy Get a -> Lazy Get a Source #

skipAll :: Lazy Get a -> Lazy Get () Source #

ConsumedInputParsing (Lazy Get) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: Lazy Get a -> Lazy Get (ParserInput (Lazy Get), a) Source #

InputParsing (Lazy Get) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Lazy Get) 
Instance details

Defined in Text.Parser.Input

type ParserInput (Lazy Get) = ByteString
type ParserPosition (Lazy Get) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (Lazy Get) = Int

Methods

getInput :: Lazy Get (ParserInput (Lazy Get)) Source #

getSourcePos :: Lazy Get (ParserPosition (Lazy Get)) Source #

anyToken :: Lazy Get (ParserInput (Lazy Get)) Source #

take :: Int -> Lazy Get (ParserInput (Lazy Get)) Source #

satisfy :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get (ParserInput (Lazy Get)) Source #

notSatisfy :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get () Source #

scan :: state -> (state -> ParserInput (Lazy Get) -> Maybe state) -> Lazy Get (ParserInput (Lazy Get)) Source #

string :: ParserInput (Lazy Get) -> Lazy Get (ParserInput (Lazy Get)) Source #

takeWhile :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get (ParserInput (Lazy Get)) Source #

takeWhile1 :: (ParserInput (Lazy Get) -> Bool) -> Lazy Get (ParserInput (Lazy Get)) Source #

CharParsing f => CharParsing (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

satisfy :: (Char -> Bool) -> Lazy f Char Source #

char :: Char -> Lazy f Char Source #

notChar :: Char -> Lazy f Char Source #

anyChar :: Lazy f Char Source #

string :: String -> Lazy f String Source #

text :: Text -> Lazy f Text Source #

Parsing f => Parsing (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

try :: Lazy f a -> Lazy f a Source #

(<?>) :: Lazy f a -> String -> Lazy f a Source #

skipMany :: Lazy f a -> Lazy f () Source #

skipSome :: Lazy f a -> Lazy f () Source #

unexpected :: String -> Lazy f a Source #

eof :: Lazy f () Source #

notFollowedBy :: Show a => Lazy f a -> Lazy f () Source #

LookAheadParsing f => LookAheadParsing (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

lookAhead :: Lazy f a -> Lazy f a Source #

TokenParsing f => TokenParsing (Lazy f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

someSpace :: Lazy f () Source #

nesting :: Lazy f a -> Lazy f a Source #

semi :: Lazy f Char Source #

highlight :: Highlight -> Lazy f a -> Lazy f a Source #

token :: Lazy f a -> Lazy f a Source #

Read (f a) => Read (Lazy f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

readsPrec :: Int -> ReadS (Lazy f a)

readList :: ReadS [Lazy f a]

readPrec :: ReadPrec (Lazy f a)

readListPrec :: ReadPrec [Lazy f a]

Show (f a) => Show (Lazy f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

showsPrec :: Int -> Lazy f a -> ShowS

show :: Lazy f a -> String

showList :: [Lazy f a] -> ShowS

Eq (f a) => Eq (Lazy f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

(==) :: Lazy f a -> Lazy f a -> Bool

(/=) :: Lazy f a -> Lazy f a -> Bool

Ord (f a) => Ord (Lazy f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

compare :: Lazy f a -> Lazy f a -> Ordering

(<) :: Lazy f a -> Lazy f a -> Bool

(<=) :: Lazy f a -> Lazy f a -> Bool

(>) :: Lazy f a -> Lazy f a -> Bool

(>=) :: Lazy f a -> Lazy f a -> Bool

max :: Lazy f a -> Lazy f a -> Lazy f a

min :: Lazy f a -> Lazy f a -> Lazy f a

type ParserInput (Lazy Get) Source # 
Instance details

Defined in Text.Parser.Input

type ParserInput (Lazy Get) = ByteString
type ParserPosition (Lazy Get) Source # 
Instance details

Defined in Text.Parser.Input

type ParserPosition (Lazy Get) = Int

newtype Strict (f :: Type -> Type) a Source #

Wrapper that signifies strict ByteString inputs

Constructors

Strict 

Fields

Instances

Instances details
Alternative f => Alternative (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

empty :: Strict f a

(<|>) :: Strict f a -> Strict f a -> Strict f a

some :: Strict f a -> Strict f [a] #

many :: Strict f a -> Strict f [a] #

Applicative f => Applicative (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

pure :: a -> Strict f a

(<*>) :: Strict f (a -> b) -> Strict f a -> Strict f b

liftA2 :: (a -> b -> c) -> Strict f a -> Strict f b -> Strict f c

(*>) :: Strict f a -> Strict f b -> Strict f b

(<*) :: Strict f a -> Strict f b -> Strict f a

Functor f => Functor (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

fmap :: (a -> b) -> Strict f a -> Strict f b

(<$) :: a -> Strict f b -> Strict f a

Monad f => Monad (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

(>>=) :: Strict f a -> (a -> Strict f b) -> Strict f b

(>>) :: Strict f a -> Strict f b -> Strict f b

return :: a -> Strict f a

MonadPlus f => MonadPlus (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

mzero :: Strict f a

mplus :: Strict f a -> Strict f a -> Strict f a

DeterministicParsing (Strict Get) Source # 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: Strict Get a -> Strict Get a -> Strict Get a Source #

takeOptional :: Strict Get a -> Strict Get (Maybe a) Source #

takeMany :: Strict Get a -> Strict Get [a] Source #

takeSome :: Strict Get a -> Strict Get [a] Source #

concatAll :: Monoid a => Strict Get a -> Strict Get a Source #

skipAll :: Strict Get a -> Strict Get () Source #

ConsumedInputParsing (Strict Get) Source # 
Instance details

Defined in Text.Parser.Input

Methods

match :: Strict Get a -> Strict Get (ParserInput (Strict Get), a) Source #

InputParsing (Strict Get) Source # 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Strict Get) 
Instance details

Defined in Text.Parser.Input

type ParserInput (Strict Get) = ByteString
type ParserPosition (Strict Get) 
Instance details

Defined in Text.Parser.Input

type ParserPosition (Strict Get) = Int

Methods

getInput :: Strict Get (ParserInput (Strict Get)) Source #

getSourcePos :: Strict Get (ParserPosition (Strict Get)) Source #

anyToken :: Strict Get (ParserInput (Strict Get)) Source #

take :: Int -> Strict Get (ParserInput (Strict Get)) Source #

satisfy :: (ParserInput (Strict Get) -> Bool) -> Strict Get (ParserInput (Strict Get)) Source #

notSatisfy :: (ParserInput (Strict Get) -> Bool) -> Strict Get () Source #

scan :: state -> (state -> ParserInput (Strict Get) -> Maybe state) -> Strict Get (ParserInput (Strict Get)) Source #

string :: ParserInput (Strict Get) -> Strict Get (ParserInput (Strict Get)) Source #

takeWhile :: (ParserInput (Strict Get) -> Bool) -> Strict Get (ParserInput (Strict Get)) Source #

takeWhile1 :: (ParserInput (Strict Get) -> Bool) -> Strict Get (ParserInput (Strict Get)) Source #

CharParsing f => CharParsing (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

satisfy :: (Char -> Bool) -> Strict f Char Source #

char :: Char -> Strict f Char Source #

notChar :: Char -> Strict f Char Source #

anyChar :: Strict f Char Source #

string :: String -> Strict f String Source #

text :: Text -> Strict f Text Source #

Parsing f => Parsing (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

try :: Strict f a -> Strict f a Source #

(<?>) :: Strict f a -> String -> Strict f a Source #

skipMany :: Strict f a -> Strict f () Source #

skipSome :: Strict f a -> Strict f () Source #

unexpected :: String -> Strict f a Source #

eof :: Strict f () Source #

notFollowedBy :: Show a => Strict f a -> Strict f () Source #

LookAheadParsing f => LookAheadParsing (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

lookAhead :: Strict f a -> Strict f a Source #

TokenParsing f => TokenParsing (Strict f) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

someSpace :: Strict f () Source #

nesting :: Strict f a -> Strict f a Source #

semi :: Strict f Char Source #

highlight :: Highlight -> Strict f a -> Strict f a Source #

token :: Strict f a -> Strict f a Source #

Read (f a) => Read (Strict f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

readsPrec :: Int -> ReadS (Strict f a)

readList :: ReadS [Strict f a]

readPrec :: ReadPrec (Strict f a)

readListPrec :: ReadPrec [Strict f a]

Show (f a) => Show (Strict f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

showsPrec :: Int -> Strict f a -> ShowS

show :: Strict f a -> String

showList :: [Strict f a] -> ShowS

Eq (f a) => Eq (Strict f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

(==) :: Strict f a -> Strict f a -> Bool

(/=) :: Strict f a -> Strict f a -> Bool

Ord (f a) => Ord (Strict f a) Source # 
Instance details

Defined in Text.Parser.Wrapper

Methods

compare :: Strict f a -> Strict f a -> Ordering

(<) :: Strict f a -> Strict f a -> Bool

(<=) :: Strict f a -> Strict f a -> Bool

(>) :: Strict f a -> Strict f a -> Bool

(>=) :: Strict f a -> Strict f a -> Bool

max :: Strict f a -> Strict f a -> Strict f a

min :: Strict f a -> Strict f a -> Strict f a

type ParserInput (Strict Get) Source # 
Instance details

Defined in Text.Parser.Input

type ParserInput (Strict Get) = ByteString
type ParserPosition (Strict Get) Source # 
Instance details

Defined in Text.Parser.Input

type ParserPosition (Strict Get) = Int