hledger-iadd-1.3.2: A terminal UI as drop-in replacement for hledger add

Safe HaskellNone




Compatibility module to bridge the gap between megaparsec-5 and megaparsec-6

Import this instead of Text.Megaparsec, Text.Megaparsec.Char and Text.Megaparsec.Text



Compatibility reimplementations

type Parser = Parsec Dec Text Source #

Same as the type in Text.Megaparsec.Text from megaparsec-5

type Dec = Void Source #

Custom error type for when no custom errors are needed

string :: MonadParsec e s m => Tokens s -> m (Tokens s) Source #

Reimplementation of string, but specialized to Text.

Custom error handling

data CustomError e Source #

Custom error type that mimics FancyError of megaparsec-6 but retains information about unexpected and expected tokens.

mkCustomError :: SourcePos -> e -> ParseError t (CustomError e) Source #

Wrap a custom error type into a ParseError.

addCustomError :: Ord e => ParseError Char (CustomError e) -> e -> ParseError Char (CustomError e) Source #

Add a custom error to an already existing error.

This retains the original information such as expected and unexpected tokens as well as the source position.

Additional helpers

parseWithStart :: (Stream s, Ord e) => Parsec e s a -> SourcePos -> s -> Either (ParseError (Token s) e) a Source #

Like parse, but start at a specific source position instead of 0.