git.iko.soy/typeable/pandoc
on master help sign in
Custom writer: fixed some compiler warnings for ghc < 7.10.
3534ad3John MacFarlane
src/Text/Pandoc/Writers/Custom.hs+17−12
@@ -57,24 +57,17 @@ attrToMap (id',classes,keyvals) = M.fromList
57 : ("class", unwords classes)
57 : ("class", unwords classes)
58 : keyvals
58 : keyvals
59
59
60−getList :: StackValue a => LuaState -> Int -> IO [a]
61−getList lua i' = do
62− continue <- Lua.next lua i'
63− if continue
64− then do
65− next <- Lua.peek lua (-1)
66− Lua.pop lua 1
67− x <- maybe (fail "peek returned Nothing") return next
68− rest <- getList lua i'
69− return (x : rest)
70− else return []
71−
72#if MIN_VERSION_hslua(0,4,0)
60#if MIN_VERSION_hslua(0,4,0)
61+#if MIN_VERSION_base(4,8,0)
73instance {-# OVERLAPS #-} StackValue [Char] where
62instance {-# OVERLAPS #-} StackValue [Char] where
63+#else
64+instance StackValue [Char] where
65+#endif
74 push lua cs = Lua.push lua (UTF8.fromString cs)
66 push lua cs = Lua.push lua (UTF8.fromString cs)
75 peek lua i = do
67 peek lua i = do
76 res <- Lua.peek lua i
68 res <- Lua.peek lua i
77 return $ UTF8.toString `fmap` res
69 return $ UTF8.toString `fmap` res
70+ valuetype _ = Lua.TSTRING
78#else
71#else
79#if MIN_VERSION_base(4,8,0)
72#if MIN_VERSION_base(4,8,0)
80instance {-# OVERLAPS #-} StackValue a => StackValue [a] where
73instance {-# OVERLAPS #-} StackValue a => StackValue [a] where
@@ -93,6 +86,18 @@ instance StackValue a => StackValue [a] where
93 Lua.pop lua 1
86 Lua.pop lua 1
94 return (Just lst)
87 return (Just lst)
95 valuetype _ = Lua.TTABLE
88 valuetype _ = Lua.TTABLE
89+
90+getList :: StackValue a => LuaState -> Int -> IO [a]
91+getList lua i' = do
92+ continue <- Lua.next lua i'
93+ if continue
94+ then do
95+ next <- Lua.peek lua (-1)
96+ Lua.pop lua 1
97+ x <- maybe (fail "peek returned Nothing") return next
98+ rest <- getList lua i'
99+ return (x : rest)
100+ else return []
96#endif
101#endif
97
102
98instance StackValue Format where
103instance StackValue Format where