@@ -69,6 +69,13 @@ getList lua i' = do
6969 return (x : rest)
7070 else return []
7171
72+#if MIN_VERSION_hslua(0,4,0)
73+instance {-# OVERLAPS #-} StackValue [Char] where
74+ push lua cs = Lua.push lua (UTF8.fromString cs)
75+ peek lua i = do
76+ res <- Lua.peek lua i
77+ return $ UTF8.toString `fmap` res
78+#else
7279#if MIN_VERSION_base(4,8,0)
7380instance {-# OVERLAPS #-} StackValue a => StackValue [a] where
7481#else
@@ -86,6 +93,7 @@ instance StackValue a => StackValue [a] where
8693 Lua.pop lua 1
8794 return (Just lst)
8895 valuetype _ = Lua.TTABLE
96+#endif
8997
9098instance StackValue Format where
9199 push lua (Format f) = Lua.push lua (map toLower f)
@@ -111,12 +119,20 @@ instance (StackValue a, StackValue b) => StackValue (a,b) where
111119 peek _ _ = undefined -- not needed for our purposes
112120 valuetype _ = Lua.TTABLE
113121
122+#if MIN_VERSION_base(4,8,0)
123+instance {-# OVERLAPS #-} StackValue [Inline] where
124+#else
114125instance StackValue [Inline] where
126+#endif
115127 push l ils = Lua.push l =<< inlineListToCustom l ils
116128 peek _ _ = undefined
117129 valuetype _ = Lua.TSTRING
118130
131+#if MIN_VERSION_base(4,8,0)
132+instance {-# OVERLAPS #-} StackValue [Block] where
133+#else
119134instance StackValue [Block] where
135+#endif
120136 push l ils = Lua.push l =<< blockListToCustom l ils
121137 peek _ _ = undefined
122138 valuetype _ = Lua.TSTRING
@@ -167,7 +183,11 @@ writeCustom luaFile opts doc@(Pandoc meta _) = do
167183 -- check for error in lua script (later we'll change the return type
168184 -- to handle this more gracefully):
169185 when (status /= 0) $
186+#if MIN_VERSION_hslua(0,4,0)
187+ Lua.tostring lua 1 >>= throw . PandocLuaException . UTF8.toString
188+#else
170189 Lua.tostring lua 1 >>= throw . PandocLuaException
190+#endif
171191 Lua.call lua 0 0
172192 -- TODO - call hierarchicalize, so we have that info
173193 rendered <- docToCustom lua opts doc