git.iko.soy/typeable/pandoc
on master help sign in
Class: removed 'fail' from PandocMonad.

Do we need this? I don't see why. There's a name clash which would better be avoided.

commitb5d15670223ada11a357161f3b057fae6f852554 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 10 Dec 2016, 23:41 (10 years ago) parent73f3736
2 files changed+13−13
src/Text/Pandoc/Class.hs+12−12 src/Text/Pandoc/Writers/Docx.hs+1−1
src/Text/Pandoc/Class.hs+12−12
@@ -58,8 +58,7 @@ module Text.Pandoc.Class ( PandocMonad(..)
5858 , withWarningsToStderr
5959 ) where
6060
61−import Prelude hiding (readFile, fail)
62−import qualified Control.Monad as M (fail)
61+import Prelude hiding (readFile)
6362import System.Random (StdGen, next, mkStdGen)
6463import qualified System.Random as IO (newStdGen)
6564import Codec.Archive.Zip (Archive, fromArchive, emptyArchive)
@@ -90,11 +89,12 @@ import System.FilePath.Glob (match, compile)
9089import System.FilePath ((</>))
9190import qualified System.FilePath.Glob as IO (glob)
9291import qualified System.Directory as IO (getModificationTime)
93−import Control.Monad.State hiding (fail)
92+import Control.Monad as M (fail)
9493import Control.Monad.Reader (ReaderT)
94+import Control.Monad.State
95+import Control.Monad.Except
9596import Control.Monad.Writer (WriterT)
9697import Control.Monad.RWS (RWST)
97−import Control.Monad.Except hiding (fail)
9898import Data.Word (Word8)
9999import Data.Default
100100import System.IO.Error
@@ -121,7 +121,7 @@ class (Functor m, Applicative m, Monad m, MonadError PandocError m)
121121 -> Maybe String
122122 -> String
123123 -> m (Either E.SomeException (B.ByteString, Maybe MimeType))
124− fail :: String -> m b
124+ -- fail :: String -> m b
125125 glob :: String -> m [FilePath]
126126 getModificationTime :: FilePath -> m UTCTime
127127 getCommonState :: m CommonState
@@ -231,7 +231,7 @@ instance PandocMonad PandocIO where
231231 case eitherBS of
232232 Right bs -> return bs
233233 Left _ -> throwError $ PandocFileReadError fname
234− fail = M.fail
234+ -- fail = M.fail
235235 fetchItem ms s = liftIO $ IO.fetchItem ms s
236236 fetchItem' mb ms s = liftIO $ IO.fetchItem' mb ms s
237237 glob = liftIO . IO.glob
@@ -361,7 +361,7 @@ instance PandocMonad PandocPure where
361361 case infoFileContents <$> (getFileInfo (userDir </> fname) userDirFiles) of
362362 Just bs -> return bs
363363 Nothing -> readDataFile Nothing fname
364− fail = M.fail
364+ -- fail = M.fail
365365 fetchItem _ fp = do
366366 fps <- getsPureState stFiles
367367 case infoFileContents <$> (getFileInfo fp fps) of
@@ -396,7 +396,7 @@ instance PandocMonad m => PandocMonad (ParserT s st m) where
396396 newUniqueHash = lift newUniqueHash
397397 readFileLazy = lift . readFileLazy
398398 readDataFile mbuserdir = lift . readDataFile mbuserdir
399− fail = lift . fail
399+ -- fail = lift . fail
400400 fetchItem media = lift . fetchItem media
401401 fetchItem' media sourceUrl = lift . fetchItem' media sourceUrl
402402 glob = lift . glob
@@ -414,7 +414,7 @@ instance PandocMonad m => PandocMonad (ReaderT r m) where
414414 newUniqueHash = lift newUniqueHash
415415 readFileLazy = lift . readFileLazy
416416 readDataFile mbuserdir = lift . readDataFile mbuserdir
417− fail = lift . fail
417+ -- fail = lift . fail
418418 fetchItem media = lift . fetchItem media
419419 fetchItem' media sourceUrl = lift . fetchItem' media sourceUrl
420420 glob = lift . glob
@@ -432,7 +432,7 @@ instance (PandocMonad m, Monoid w) => PandocMonad (WriterT w m) where
432432 newUniqueHash = lift newUniqueHash
433433 readFileLazy = lift . readFileLazy
434434 readDataFile mbuserdir = lift . readDataFile mbuserdir
435− fail = lift . fail
435+ -- fail = lift . fail
436436 fetchItem media = lift . fetchItem media
437437 fetchItem' media sourceUrl = lift . fetchItem' media sourceUrl
438438 glob = lift . glob
@@ -450,7 +450,7 @@ instance (PandocMonad m, Monoid w) => PandocMonad (RWST r w st m) where
450450 newUniqueHash = lift newUniqueHash
451451 readFileLazy = lift . readFileLazy
452452 readDataFile mbuserdir = lift . readDataFile mbuserdir
453− fail = lift . fail
453+ -- fail = lift . fail
454454 fetchItem media = lift . fetchItem media
455455 fetchItem' media sourceUrl = lift . fetchItem' media sourceUrl
456456 glob = lift . glob
@@ -468,7 +468,7 @@ instance PandocMonad m => PandocMonad (StateT st m) where
468468 newUniqueHash = lift newUniqueHash
469469 readFileLazy = lift . readFileLazy
470470 readDataFile mbuserdir = lift . readDataFile mbuserdir
471− fail = lift . fail
471+ -- fail = lift . fail
472472 fetchItem media = lift . fetchItem media
473473 fetchItem' media sourceUrl = lift . fetchItem' media sourceUrl
474474 glob = lift . glob
src/Text/Pandoc/Writers/Docx.hs+1−1
@@ -1276,7 +1276,7 @@ parseXml refArchive distArchive relpath =
12761276 findEntryByPath relpath distArchive of
12771277 Nothing -> fail $ relpath ++ " missing in reference docx"
12781278 Just e -> case parseXMLDoc . UTF8.toStringLazy . fromEntry $ e of
1279− Nothing -> P.fail $ relpath ++ " corrupt in reference docx"
1279+ Nothing -> fail $ relpath ++ " corrupt in reference docx"
12801280 Just d -> return d
12811281
12821282-- | Scales the image to fit the page