summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-05-31 21:18:26 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2015-05-31 21:18:26 +0200
commit3534ad366667a98c7bec05ee2df224d51def06b5 (patch)
treef16ce1f17fc5d50c74b6f4ea0623115ba5f618a5 /src
parentcb339c74259cf9093e5bee88a11326b6cfdce95f (diff)
Custom writer: fixed some compiler warnings for ghc < 7.10.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Custom.hs29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs
index abf676fdf..3a9c1954a 100644
--- a/src/Text/Pandoc/Writers/Custom.hs
+++ b/src/Text/Pandoc/Writers/Custom.hs
@@ -57,24 +57,17 @@ attrToMap (id',classes,keyvals) = M.fromList
: ("class", unwords classes)
: keyvals
-getList :: StackValue a => LuaState -> Int -> IO [a]
-getList lua i' = do
- continue <- Lua.next lua i'
- if continue
- then do
- next <- Lua.peek lua (-1)
- Lua.pop lua 1
- x <- maybe (fail "peek returned Nothing") return next
- rest <- getList lua i'
- return (x : rest)
- else return []
-
#if MIN_VERSION_hslua(0,4,0)
+#if MIN_VERSION_base(4,8,0)
instance {-# OVERLAPS #-} StackValue [Char] where
+#else
+instance StackValue [Char] where
+#endif
push lua cs = Lua.push lua (UTF8.fromString cs)
peek lua i = do
res <- Lua.peek lua i
return $ UTF8.toString `fmap` res
+ valuetype _ = Lua.TSTRING
#else
#if MIN_VERSION_base(4,8,0)
instance {-# OVERLAPS #-} StackValue a => StackValue [a] where
@@ -93,6 +86,18 @@ instance StackValue a => StackValue [a] where
Lua.pop lua 1
return (Just lst)
valuetype _ = Lua.TTABLE
+
+getList :: StackValue a => LuaState -> Int -> IO [a]
+getList lua i' = do
+ continue <- Lua.next lua i'
+ if continue
+ then do
+ next <- Lua.peek lua (-1)
+ Lua.pop lua 1
+ x <- maybe (fail "peek returned Nothing") return next
+ rest <- getList lua i'
+ return (x : rest)
+ else return []
#endif
instance StackValue Format where