aboutsummaryrefslogtreecommitdiff
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
parent9a0333e48917308f15d5ccda246dd31525501f79 (diff)
downloadpandoc-6b7a7adcbf2415230ac866b56841b1017c5264eb.tar.gz
Fix readWithM with Stream.
-rw-r--r--pandoc.cabal3
-rw-r--r--src/Text/Pandoc/Parsing.hs6
-rw-r--r--src/Text/Pandoc/Readers/Roff.hs2
3 files changed, 4 insertions, 7 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index a6bf04296..0f6cdbf75 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -394,8 +394,7 @@ library
http-types >= 0.8 && < 0.13,
case-insensitive >= 1.2 && < 1.3,
unicode-transforms >= 0.3 && < 0.4,
- HsYAML >= 0.1.1.1 && < 0.2,
- monad-loops >= 0.4 && < 0.5
+ HsYAML >= 0.1.1.1 && < 0.2
if impl(ghc < 8.0)
build-depends: semigroups == 0.18.*,
-- basement 0.0.8 and foundation 0.0.21, transitive
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,