@@ -1044,19 +1044,13 @@ gridTableFooter = blanklines
10441044---
10451045
10461046-- | Removes the ParsecT layer from the monad transformer stack
1047−readWithM :: (Monad m, Stream s m Char)
1048− => ParserT s st m a -- ^ parser
1049− -> st -- ^ initial state
1050− -> s -- ^ input
1047+readWithM :: (Monad m, Stream s m Char, ToString s)
1048+ => ParserT s st m a -- ^ parser
1049+ -> st -- ^ initial state
1050+ -> s -- ^ input
10511051 -> m (Either PandocError a)
1052−readWithM parser state input = do
1053− res <- runParserT parser state "source" input
1054− case res of
1055− Right x -> return $ Right x
1056− Left e -> do
1057− inp <- either (const "") id
1058− <$> runParserT (many1 anyChar) state "source" input
1059− return $ Left $ PandocParsecError inp e
1052+readWithM parser state input =
1053+ mapLeft (PandocParsecError $ toString input) `liftM` runParserT parser state "source" input
10601054
10611055-- | Parse a string with a given parser and state
10621056readWith :: Parser [Char] st a