@@ -127,6 +127,7 @@ import Text.Pandoc.MIME (MimeType, getMimeType)
127import System.FilePath ( (</>), takeExtension, dropExtension)
127import System.FilePath ( (</>), takeExtension, dropExtension)
128import Data.Generics (Typeable, Data)
128import Data.Generics (Typeable, Data)
129import qualified Control.Monad.State as S
129import qualified Control.Monad.State as S
130+import Control.Monad.Trans (MonadIO (..))
130import qualified Control.Exception as E
131import qualified Control.Exception as E
131import Control.Monad (msum, unless, MonadPlus(..))
132import Control.Monad (msum, unless, MonadPlus(..))
132import Text.Pandoc.Pretty (charWidth)
133import Text.Pandoc.Pretty (charWidth)
@@ -974,7 +975,7 @@ openURL u
974 UTF8.toString `fmap` lookup hContentType (responseHeaders resp))
975 UTF8.toString `fmap` lookup hContentType (responseHeaders resp))
976 | otherwise = E.try $ getBodyAndMimeType `fmap` browse
977 | otherwise = E.try $ getBodyAndMimeType `fmap` browse
977− (do S.liftIO $ UTF8.hPutStrLn stderr $ "Fetching " ++ u ++ "..."
978+ (do liftIO $ UTF8.hPutStrLn stderr $ "Fetching " ++ u ++ "..."
978 setOutHandler $ const (return ())
979 setOutHandler $ const (return ())
979 setAllowRedirects True
980 setAllowRedirects True
980 request (getRequest' u'))
981 request (getRequest' u'))
@@ -997,10 +998,10 @@ err exitCode msg = do
997 exitWith $ ExitFailure exitCode
998 exitWith $ ExitFailure exitCode
998 return undefined
999 return undefined
1000−warn :: String -> IO ()
1001+warn :: MonadIO m => String -> m ()
1001−warn msg = do
1002+warn msg = liftIO $ do
1002 name <- getProgName
1003 name <- getProgName
1003− UTF8.hPutStrLn stderr $ name ++ ": " ++ msg
1004+ UTF8.hPutStrLn stderr $ "[" ++ name ++ " warning] " ++ msg
1005mapLeft :: (a -> b) -> Either a c -> Either b c
1006mapLeft :: (a -> b) -> Either a c -> Either b c
1006mapLeft f (Left x) = Left (f x)
1007mapLeft f (Left x) = Left (f x)