diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-08-22 12:01:28 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-08-24 22:17:52 -0700 |
commit | 0df003b099ca16bddee215d6b9f151591f57c6d1 (patch) | |
tree | 069b9c90df61075b5cd8cadcdf3b929881e3fa75 /src/Text/Pandoc/Lua/PandocLua.hs | |
parent | 7ff06a8c43019f56db3e647a55d4d8ec82d2fd62 (diff) | |
download | pandoc-0df003b099ca16bddee215d6b9f151591f57c6d1.tar.gz |
Lua subsystem and custom writers: generalize types from PandocIO...
to any instance of PandocMonad and MonadIO.
This involves an API change, since the type of
runLua is now
(PandocMonad m, MonadIO m) => Lua a -> m (Either PandocError a)
Diffstat (limited to 'src/Text/Pandoc/Lua/PandocLua.hs')
-rw-r--r-- | src/Text/Pandoc/Lua/PandocLua.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Lua/PandocLua.hs b/src/Text/Pandoc/Lua/PandocLua.hs index 750e019b6..3f6641f95 100644 --- a/src/Text/Pandoc/Lua/PandocLua.hs +++ b/src/Text/Pandoc/Lua/PandocLua.hs @@ -30,7 +30,6 @@ import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow) import Control.Monad.Except (MonadError (catchError, throwError)) import Control.Monad.IO.Class (MonadIO (liftIO)) import Foreign.Lua (Lua (..), NumResults, Pushable, ToHaskellFunction) -import Text.Pandoc.Class.PandocIO (PandocIO) import Text.Pandoc.Class.PandocMonad (PandocMonad (..), readDefaultDataFile) import Text.Pandoc.Error (PandocError (PandocLuaError)) import Text.Pandoc.Lua.Global (Global (..), setGlobals) @@ -59,7 +58,7 @@ liftPandocLua = PandocLua -- | Evaluate a @'PandocLua'@ computation, running all contained Lua -- operations.. -runPandocLua :: PandocLua a -> PandocIO a +runPandocLua :: (PandocMonad m, MonadIO m) => PandocLua a -> m a runPandocLua pLua = do origState <- getCommonState globals <- defaultGlobals @@ -103,7 +102,7 @@ loadDefaultModule name = do throwError $ PandocLuaError (T.pack err) -- | Global variables which should always be set. -defaultGlobals :: PandocIO [Global] +defaultGlobals :: PandocMonad m => m [Global] defaultGlobals = do commonState <- getCommonState return |