aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-11-02 20:26:36 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-11-02 20:26:36 -0700
commit6b7a7adcbf2415230ac866b56841b1017c5264eb (patch)
treeb21eb32adf933f6f088c0a13bda597073bdfa495 /src/Text
parent9a0333e48917308f15d5ccda246dd31525501f79 (diff)
downloadpandoc-6b7a7adcbf2415230ac866b56841b1017c5264eb.tar.gz
Fix readWithM with Stream.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Parsing.hs6
-rw-r--r--src/Text/Pandoc/Readers/Roff.hs2
2 files changed, 3 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index d53ea129b..788744db3 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -198,7 +198,6 @@ where
import Prelude
import Control.Monad.Identity
-import Control.Monad.Loops (unfoldM)
import Control.Monad.Reader
import Data.Char (chr, isAlphaNum, isAscii, isAsciiUpper,
isPunctuation, isSpace, ord, toLower, toUpper)
@@ -222,7 +221,6 @@ import Text.Pandoc.Shared
import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn)
import Text.Pandoc.XML (fromEntities)
import Text.Parsec hiding (token)
-import qualified Text.Parsec (uncons)
import Text.Parsec.Pos (initialPos, newPos, updatePosString)
import Control.Monad.Except
@@ -1056,10 +1054,10 @@ readWithM parser state input = do
case res of
Right x -> return $ Right x
Left e -> do
- inp <- map fst <$> unfoldM (Text.Parsec.uncons input)
+ inp <- either (const "") id
+ <$> runParserT (many1 anyChar) state "source" input
return $ Left $ PandocParsecError inp e
-
-- | Parse a string with a given parser and state
readWith :: Parser [Char] st a
-> st
diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs
index d46ddd103..632578da7 100644
--- a/src/Text/Pandoc/Readers/Roff.hs
+++ b/src/Text/Pandoc/Readers/Roff.hs
@@ -53,7 +53,7 @@ import Prelude
import Safe (lastDef)
import Control.Monad (void, mzero, mplus, guard)
import Control.Monad.Except (throwError)
-import Control.Monad.State.Strict (StateT(..), evalStateT, get, modify, put)
+import Control.Monad.State (StateT(..), evalStateT, get, modify, put)
import Text.Pandoc.Class
(getResourcePath, readFileFromDirs, PandocMonad(..), report)
import Data.Char (isLower, toLower, toUpper, chr,