git.iko.soy/typeable/pandoc
on master help sign in
Changed parseWithWarnings to the more general returnWarnings parser transformer
commit5dc902cbcca92326126ef3647a3cebf2ae3071a5 authorMatthew Pickering <matthewtpickering@gmail.com> dateFri 30 Jan 2015, 12:31 (12 years ago) parentf6419a2
2 files changed+6−7
src/Text/Pandoc/Parsing.hs+5−6 src/Text/Pandoc/Readers/RST.hs+1−1
src/Text/Pandoc/Parsing.hs+5−6
@@ -65,7 +65,7 @@ module Text.Pandoc.Parsing ( anyLine,
6565 widthsFromIndices,
6666 gridTableWith,
6767 readWith,
68− readWithWarnings,
68+ returnWarnings,
6969 readWithM,
7070 testStringWith,
7171 guardEnabled,
@@ -885,11 +885,10 @@ readWith :: Parser [Char] st a
885885 -> a
886886readWith p t inp = runIdentity $ readWithM p t inp
887887
888−readWithWarnings :: Parser [Char] ParserState a
889− -> ParserState
890− -> String
891− -> (a, [String])
892−readWithWarnings p = readWith $ do
888+returnWarnings :: (Stream s m c)
889+ => ParserT s ParserState m a
890+ -> ParserT s ParserState m (a, [String])
891+returnWarnings p = do
893892 doc <- p
894893 warnings <- stateWarnings <$> getState
895894 return (doc, warnings)
src/Text/Pandoc/Readers/RST.hs+1−1
@@ -58,7 +58,7 @@ readRST :: ReaderOptions -- ^ Reader options
5858readRST opts s = (readWith parseRST) def{ stateOptions = opts } (s ++ "\n\n")
5959
6060readRSTWithWarnings :: ReaderOptions -> String -> (Pandoc, [String])
61−readRSTWithWarnings opts s = (readWithWarnings parseRST) def{ stateOptions = opts } (s ++ "\n\n")
61+readRSTWithWarnings opts s = (readWith (returnWarnings parseRST)) def{ stateOptions = opts } (s ++ "\n\n")
6262
6363type RSTParser = Parser [Char] ParserState
6464