From 3a36441b617b9dff632eda0ac14ca26072e0730b Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 13 Jul 2017 23:37:21 +0200
Subject: [PATCH] Use foldrWithKey instead of deprecated foldWithKey.

---
 pandoc.cabal                      | 4 ++--
 src/Text/Pandoc/MediaBag.hs       | 2 +-
 src/Text/Pandoc/Writers/Shared.hs | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pandoc.cabal b/pandoc.cabal
index dd92690ce..2734dcb02 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -283,7 +283,7 @@ Flag old-locale
 Library
   Build-Depends: base >= 4.7 && < 5,
                  syb >= 0.1 && < 0.8,
-                 containers >= 0.1 && < 0.6,
+                 containers >= 0.4.2.1 && < 0.6,
                  unordered-containers >= 0.2 && < 0.3,
                  parsec >= 3.1 && < 3.2,
                  mtl >= 2.2 && < 2.3,
@@ -546,7 +546,7 @@ Test-Suite test-pandoc
                   tasty-quickcheck >= 0.8 && < 0.9,
                   tasty-golden >= 2.3 && < 2.4,
                   QuickCheck >= 2.4 && < 2.11,
-                  containers >= 0.1 && < 0.6,
+                  containers >= 0.4.2.1 && < 0.6,
                   executable-path >= 0.0 && < 0.1,
                   zip-archive >= 0.2.3.4 && < 0.4,
                   mtl >= 2.2 && < 2.3
diff --git a/src/Text/Pandoc/MediaBag.hs b/src/Text/Pandoc/MediaBag.hs
index d8d6da345..f89c60c9e 100644
--- a/src/Text/Pandoc/MediaBag.hs
+++ b/src/Text/Pandoc/MediaBag.hs
@@ -79,5 +79,5 @@ lookupMedia fp (MediaBag mediamap) = M.lookup (splitDirectories fp) mediamap
 -- their corresponding mime types and the lengths in bytes of the contents.
 mediaDirectory :: MediaBag -> [(String, MimeType, Int)]
 mediaDirectory (MediaBag mediamap) =
-  M.foldWithKey (\fp (mime,contents) ->
+  M.foldrWithKey (\fp (mime,contents) ->
       (((Posix.joinPath fp), mime, fromIntegral $ BL.length contents):)) [] mediamap
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 2047285eb..3f612f40a 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -84,7 +84,7 @@ metaToJSON' blockWriter inlineWriter (Meta metamap) = do
   renderedMap <- Traversable.mapM
                  (metaValueToJSON blockWriter inlineWriter)
                  metamap
-  return $ M.foldWithKey defField (Object H.empty) renderedMap
+  return $ M.foldrWithKey defField (Object H.empty) renderedMap
 
 -- | Add variables to JSON object, replacing any existing values.
 -- Also include @meta-json@, a field containing a string representation