hledger-lib-1.0.1: Core data types, parsers and functionality for the hledger accounting tools

Safe HaskellNone
LanguageHaskell2010

Hledger.Utils.Parse

Synopsis

Documentation

type TextParser m a = ParsecT Dec Text m a Source #

A parser of strict text with generic user state, monad and return type.

type ErroringJournalParser a = StateT Journal (ParsecT Dec Text (ExceptT String IO)) a Source #

A journal parser that runs in IO and can throw an error mid-parse.

choice' :: [TextParser m a] -> TextParser m a Source #

Backtracking choice, use this when alternatives share a prefix. Consumes no input if all choices fail.

choiceInState :: [StateT s (ParsecT Dec Text m) a] -> StateT s (ParsecT Dec Text m) a Source #

Backtracking choice, use this when alternatives share a prefix. Consumes no input if all choices fail.

parseWithState :: Monad m => st -> StateT st (ParsecT Dec Text m) a -> Text -> m (Either (ParseError Char Dec) a) Source #

parseWithState' :: (Stream s, ErrorComponent e) => st -> StateT st (ParsecT e s Identity) a -> s -> Either (ParseError (Token s) e) a Source #

fromparse :: (Show t, Show e) => Either (ParseError t e) a -> a Source #

parseerror :: (Show t, Show e) => ParseError t e -> a Source #