aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Filter/Lua.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Filter/Lua.hs')
-rw-r--r--src/Text/Pandoc/Filter/Lua.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Filter/Lua.hs b/src/Text/Pandoc/Filter/Lua.hs
index c238e53d9..4e264261b 100644
--- a/src/Text/Pandoc/Filter/Lua.hs
+++ b/src/Text/Pandoc/Filter/Lua.hs
@@ -14,7 +14,8 @@ module Text.Pandoc.Filter.Lua (apply) where
import Control.Exception (throw)
import Control.Monad ((>=>))
import qualified Data.Text as T
-import Text.Pandoc.Class.PandocIO (PandocIO)
+import Text.Pandoc.Class (PandocMonad)
+import Control.Monad.Trans (MonadIO)
import Text.Pandoc.Definition (Pandoc)
import Text.Pandoc.Error (PandocError (PandocFilterError, PandocLuaError))
import Text.Pandoc.Lua (Global (..), runLua, runFilterFile, setGlobals)
@@ -23,11 +24,12 @@ import Text.Pandoc.Options (ReaderOptions)
-- | Run the Lua filter in @filterPath@ for a transformation to the
-- target format (first element in args). Pandoc uses Lua init files to
-- setup the Lua interpreter.
-apply :: ReaderOptions
+apply :: (PandocMonad m, MonadIO m)
+ => ReaderOptions
-> [String]
-> FilePath
-> Pandoc
- -> PandocIO Pandoc
+ -> m Pandoc
apply ropts args fp doc = do
let format = case args of
(x:_) -> x
@@ -39,7 +41,8 @@ apply ropts args fp doc = do
]
runFilterFile fp doc
-forceResult :: FilePath -> Either PandocError Pandoc -> PandocIO Pandoc
+forceResult :: (PandocMonad m, MonadIO m)
+ => FilePath -> Either PandocError Pandoc -> m Pandoc
forceResult fp eitherResult = case eitherResult of
Right x -> return x
Left err -> throw . PandocFilterError (T.pack fp) $ case err of