From a1abb3eeea2321654a8450725ff6c0d1a18ee0c7 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Tue, 14 Jan 2014 10:12:33 -0800
Subject: [PATCH] Allow binary 0.5.  Version bump to 1.12.3.1.

---
 changelog                    | 4 ++++
 pandoc.cabal                 | 4 ++--
 src/Text/Pandoc/ImageSize.hs | 9 ++++++---
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/changelog b/changelog
index 4cbc60388..fde6873ec 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,7 @@
+pandoc (1.12.3.1)
+
+  * Relaxed version constraint on binary, allowing the use of binary 0.5.
+
 pandoc (1.12.3)
 
   * The `--bibliography` option now sets the `biblio-files` variable.
diff --git a/pandoc.cabal b/pandoc.cabal
index c8ff9738a..0199996be 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
 Name:            pandoc
-Version:         1.12.3
+Version:         1.12.3.1
 Cabal-Version:   >= 1.10
 Build-Type:      Custom
 License:         GPL
@@ -233,7 +233,7 @@ Library
                  yaml >= 0.8.3 && < 0.9,
                  vector >= 0.10 && < 0.11,
                  hslua >= 0.3 && < 0.4,
-                 binary >= 0.6 && < 0.8
+                 binary >= 0.5 && < 0.8
   Build-Tools:   alex, happy
   if flag(http-conduit)
      Build-Depends: http-conduit >= 1.9 && < 2.1,
diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs
index d1aacff1c..14575244d 100644
--- a/src/Text/Pandoc/ImageSize.hs
+++ b/src/Text/Pandoc/ImageSize.hs
@@ -182,9 +182,12 @@ findJfifSize bs = do
        Nothing -> fail "Did not find length record"
 
 exifSize :: ByteString -> Maybe ImageSize
-exifSize = -- runGet ((Just <$> exifHeader) `mplus` return Nothing) .
-  runGet (Just <$> exifHeader) .
-           BL.fromChunks . (:[])
+exifSize = runGet (Just <$> exifHeader) .  BL.fromChunks . (:[])
+-- NOTE:  It would be nicer to do
+-- runGet ((Just <$> exifHeader) <|> return Nothing)
+-- which would prevent pandoc from raising an error when an exif header can't
+-- be parsed.  But we only get an Alternative instance for Get in binary 0.6,
+-- and binary 0.5 ships with ghc 7.6.
 
 exifHeader :: Get ImageSize
 exifHeader = do