aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua/Util.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-01-04 09:55:15 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-01-04 09:55:15 -0800
commit8ed749702ff62bc41a88770c7f93a283a20a2a42 (patch)
tree90d537cf4d8e47ff768d46df06059c7fdd34ab96 /src/Text/Pandoc/Lua/Util.hs
parentc5b6321b21b85ce3b6c988211d67f07de8c3efe2 (diff)
downloadpandoc-8ed749702ff62bc41a88770c7f93a283a20a2a42.tar.gz
Add type annotations to assist ghci.
Diffstat (limited to 'src/Text/Pandoc/Lua/Util.hs')
-rw-r--r--src/Text/Pandoc/Lua/Util.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Lua/Util.hs b/src/Text/Pandoc/Lua/Util.hs
index e55bc3495..9c5da1088 100644
--- a/src/Text/Pandoc/Lua/Util.hs
+++ b/src/Text/Pandoc/Lua/Util.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE OverloadedStrings #-}
{- |
Module : Text.Pandoc.Lua.Util
Copyright : © 2012–2019 John MacFarlane,
@@ -31,9 +32,9 @@ import Control.Monad (unless, when)
import Foreign.Lua ( Lua, NumArgs, NumResults, Peekable, Pushable, StackIndex
, Status, ToHaskellFunction )
import Text.Pandoc.Class (readDataFile, runIOorExplode, setUserDataDir)
-
import qualified Foreign.Lua as Lua
import qualified Text.Pandoc.UTF8 as UTF8
+import Data.Text (Text)
-- | Get value behind key from table at given index.
rawField :: Peekable a => StackIndex -> String -> Lua a
@@ -104,7 +105,7 @@ getTag :: StackIndex -> Lua String
getTag idx = do
-- push metatable or just the table
Lua.getmetatable idx >>= \hasMT -> unless hasMT (Lua.pushvalue idx)
- Lua.push "tag"
+ Lua.push ("tag" :: Text)
Lua.rawget (Lua.nthFromTop 2)
Lua.tostring Lua.stackTop <* Lua.pop 2 >>= \case
Nothing -> Lua.throwException "untagged value"