diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2015-02-02 10:38:30 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2015-02-18 12:50:21 +0000 |
commit | 9cd0bdb41a2c14e0f28e5ab179b0da73a0b8ba78 (patch) | |
tree | 943d9fa9ba60b6a52bc91c061ff4ac7af0b67c8b /src/Text/Pandoc/Parsing.hs | |
parent | febe5112af6c917525b9fded66e00abc5245ab07 (diff) |
Factor out "returnState" into Parsing module
Diffstat (limited to 'src/Text/Pandoc/Parsing.hs')
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index 3e9d559dc..aebdcae4c 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -66,6 +66,7 @@ module Text.Pandoc.Parsing ( anyLine, gridTableWith, readWith, returnWarnings, + returnState, readWithM, testStringWith, guardEnabled, @@ -873,6 +874,10 @@ returnWarnings p = do warnings <- stateWarnings <$> getState return (doc, warnings) +-- | Return the final internal state with the result of a parser +returnState :: (Stream s m c) => ParsecT s st m a -> ParsecT s st m (a, st) +returnState p = (,) <$> p <*> getState + -- | Parse a string with @parser@ (for testing). testStringWith :: (Show a, Stream [Char] Identity Char) => ParserT [Char] ParserState Identity a |