diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-11-22 10:56:59 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-11-22 10:56:59 +0100 |
commit | 77912ddc56650aacc47a4e6fe722e758a77b06e2 (patch) | |
tree | 15df26f34cb314acf63c96601d813bad7ee3dc54 /src/Text/Pandoc/Shared.hs | |
parent | 77753747d111966610b9c3cdcbe75712540bc816 (diff) |
Put 'warn' in MonadIO. Add warnings for math conversions in docx.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 4c10a5572..f06f5f1c7 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -127,6 +127,7 @@ import Text.Pandoc.MIME (MimeType, getMimeType) import System.FilePath ( (</>), takeExtension, dropExtension) import Data.Generics (Typeable, Data) import qualified Control.Monad.State as S +import Control.Monad.Trans (MonadIO (..)) import qualified Control.Exception as E import Control.Monad (msum, unless, MonadPlus(..)) import Text.Pandoc.Pretty (charWidth) @@ -974,7 +975,7 @@ openURL u UTF8.toString `fmap` lookup hContentType (responseHeaders resp)) #else | otherwise = E.try $ getBodyAndMimeType `fmap` browse - (do S.liftIO $ UTF8.hPutStrLn stderr $ "Fetching " ++ u ++ "..." + (do liftIO $ UTF8.hPutStrLn stderr $ "Fetching " ++ u ++ "..." setOutHandler $ const (return ()) setAllowRedirects True request (getRequest' u')) @@ -997,10 +998,10 @@ err exitCode msg = do exitWith $ ExitFailure exitCode return undefined -warn :: String -> IO () -warn msg = do +warn :: MonadIO m => String -> m () +warn msg = liftIO $ do name <- getProgName - UTF8.hPutStrLn stderr $ name ++ ": " ++ msg + UTF8.hPutStrLn stderr $ "[" ++ name ++ " warning] " ++ msg mapLeft :: (a -> b) -> Either a c -> Either b c mapLeft f (Left x) = Left (f x) |