@@ -25,7 +25,7 @@ import Data.Char (isAlphaNum)
2525import Data.Default
2626import Data.List (find, intersperse, sortBy, transpose)
2727import qualified Data.Map as M
28−import Data.Maybe (fromMaybe, catMaybes)
28+import Data.Maybe (fromMaybe, mapMaybe)
2929import Data.Ord (comparing)
3030import qualified Data.Set as Set
3131import Data.Text (Text)
@@ -121,7 +121,7 @@ mmdTitleBlock (Context hashmap) =
121121 | null xs -> empty
122122 | otherwise -> k' <> ":" <> space <>
123123 hcat (intersperse "; " $
124− catMaybes $ map fromVal xs)
124+ mapMaybe fromVal xs)
125125 (k', SimpleVal x)
126126 | isEmpty x -> empty
127127 | otherwise -> k' <> ":" <> space <>
@@ -256,7 +256,7 @@ keyToMarkdown opts (label', (src, tit), attr) = do
256256notesToMarkdown :: PandocMonad m => WriterOptions -> [[Block]] -> MD m (Doc Text)
257257notesToMarkdown opts notes = do
258258 n <- gets stNoteNum
259− notes' <- mapM (\(num, note) -> noteToMarkdown opts num note) (zip [n..] notes)
259+ notes' <- zipWithM (noteToMarkdown opts) [n..] notes
260260 modify $ \st -> st { stNoteNum = stNoteNum st + length notes }
261261 return $ vsep notes'
262262
@@ -647,8 +647,7 @@ blockToMarkdown' opts (OrderedList (start,sty,delim) items) = do
647647 then m <> T.replicate (3 - T.length m) " "
648648 else m) markers
649649 contents <- inList $
650− mapM (\(item, num) -> orderedListItemToMarkdown opts item num) $
651− zip markers' items
650+ zipWithM (orderedListItemToMarkdown opts) markers' items
652651 return $ (if isTightList items then vcat else vsep) contents <> blankline
653652blockToMarkdown' opts (DefinitionList items) = do
654653 contents <- inList $ mapM (definitionListItemToMarkdown opts) items
@@ -680,11 +679,11 @@ pipeTable headless aligns rawHeaders rawRows = do
680679 hcat (intersperse (literal "|") $
681680 zipWith3 blockFor aligns widths (map chomp cs))
682681 <> literal "|"
683− let toborder (a, w) = literal $ case a of
684− AlignLeft -> ":" <> T.replicate (w + 1) "-"
685− AlignCenter -> ":" <> T.replicate w "-" <> ":"
686− AlignRight -> T.replicate (w + 1) "-" <> ":"
687− AlignDefault -> T.replicate (w + 2) "-"
682+ let toborder a w = literal $ case a of
683+ AlignLeft -> ":" <> T.replicate (w + 1) "-"
684+ AlignCenter -> ":" <> T.replicate w "-" <> ":"
685+ AlignRight -> T.replicate (w + 1) "-" <> ":"
686+ AlignDefault -> T.replicate (w + 2) "-"
688687 -- note: pipe tables can't completely lack a
689688 -- header; for a headerless table, we need a header of empty cells.
690689 -- see jgm/pandoc#1996.
@@ -692,7 +691,7 @@ pipeTable headless aligns rawHeaders rawRows = do
692691 then torow (replicate (length aligns) empty)
693692 else torow rawHeaders
694693 let border = nowrap $ literal "|" <> hcat (intersperse (literal "|") $
695− map toborder $ zip aligns widths) <> literal "|"
694+ zipWith toborder aligns widths) <> literal "|"
696695 let body = vcat $ map torow rawRows
697696 return $ header $$ border $$ body
698697