@@ -113,8 +113,8 @@ wrapWords indent c = wrap' (c - indent) (c - indent)
113113isTextFormat :: String -> Bool
114114isTextFormat s = s `notElem` ["odt","docx","epub","epub3"]
115115
116−externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
117−externalFilter f args' d = do
116+externalFilter :: MonadIO m => FilePath -> [String] -> Pandoc -> m Pandoc
117+externalFilter f args' d = liftIO $ do
118118 exists <- doesFileExist f
119119 isExecutable <- if exists
120120 then executable <$> getPermissions f
@@ -1101,8 +1101,8 @@ applyTransforms transforms d = return $ foldr ($) d transforms
11011101 -- First we check to see if a filter is found. If not, and if it's
11021102 -- not an absolute path, we check to see whether it's in `userdir/filters`.
11031103 -- If not, we leave it unchanged.
1104−expandFilterPath :: Maybe FilePath -> FilePath -> IO FilePath
1105−expandFilterPath mbDatadir fp = do
1104+expandFilterPath :: MonadIO m => Maybe FilePath -> FilePath -> m FilePath
1105+expandFilterPath mbDatadir fp = liftIO $ do
11061106 fpExists <- doesFileExist fp
11071107 if fpExists
11081108 then return fp
@@ -1115,7 +1115,8 @@ expandFilterPath mbDatadir fp = do
11151115 else return fp
11161116 _ -> return fp
11171117
1118−applyFilters :: Maybe FilePath -> [FilePath] -> [String] -> Pandoc -> IO Pandoc
1118+applyFilters :: MonadIO m
1119+ => Maybe FilePath -> [FilePath] -> [String] -> Pandoc -> m Pandoc
11191120applyFilters mbDatadir filters args d = do
11201121 expandedFilters <- mapM (expandFilterPath mbDatadir) filters
11211122 foldrM ($) d $ map (flip externalFilter args) expandedFilters
@@ -1478,13 +1479,13 @@ convertWithOpts opts args = do
14781479 applyTransforms transforms >=>
14791480 applyFilters datadir filters' [format]) doc
14801481
1481− let writeFnBinary :: FilePath -> B.ByteString -> IO ()
1482− writeFnBinary "-" = B.putStr
1483− writeFnBinary f = B.writeFile (UTF8.encodePath f)
1482+ let writeFnBinary :: MonadIO m => FilePath -> B.ByteString -> m ()
1483+ writeFnBinary "-" = liftIO . B.putStr
1484+ writeFnBinary f = liftIO . B.writeFile (UTF8.encodePath f)
14841485
1485− let writerFn :: FilePath -> String -> IO ()
1486− writerFn "-" = UTF8.putStr
1487− writerFn f = UTF8.writeFile f
1486+ let writerFn :: MonadIO m => FilePath -> String -> m ()
1487+ writerFn "-" = liftIO . UTF8.putStr
1488+ writerFn f = liftIO . UTF8.writeFile f
14881489
14891490 let writerOptions' = writerOptions{ writerMediaBag = media }
14901491 case writer of