Skip to content

Instantly share code, notes, and snippets.

@hasufell
Last active April 7, 2020 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasufell/a5f1091646d1b891e6d2a73714dbb50e to your computer and use it in GitHub Desktop.
Save hasufell/a5f1091646d1b891e6d2a73714dbb50e to your computer and use it in GitHub Desktop.
From 3b6ff38dd26b8319a4d68d6998e6298857daeb6c Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Wed, 25 Mar 2020 23:11:55 +0100
Subject: [PATCH] Fix build with base >= 4.13
---
Codec/Compression/BZip/Stream.hsc | 8 ++++++++
bzlib.cabal | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Codec/Compression/BZip/Stream.hsc b/Codec/Compression/BZip/Stream.hsc
index 5a8c785..dcc7d12 100644
--- a/Codec/Compression/BZip/Stream.hsc
+++ b/Codec/Compression/BZip/Stream.hsc
@@ -69,10 +69,13 @@ import Foreign.C
import Data.ByteString.Internal (nullForeignPtr)
import System.IO.Unsafe (unsafeInterleaveIO)
import System.IO (hPutStrLn, stderr)
+#if !MIN_VERSION_base(4,13,0)
import Control.Applicative (Applicative(..))
+#endif
import Control.Monad (liftM, ap)
import Control.Exception (assert)
+import qualified Control.Monad.Fail as Fail
import Prelude hiding (length)
#include "bzlib.h"
@@ -233,6 +236,11 @@ instance Monad Stream where
-- m >>= f = (m `thenZ` \a -> consistencyCheck `thenZ_` returnZ a) `thenZ` f
(>>) = thenZ_
return = returnZ
+#if !MIN_VERSION_base(4,13,0)
+ fail = Fail.fail
+#endif
+
+instance Fail.MonadFail Stream where
fail = (finalise >>) . failZ
returnZ :: a -> Stream a
diff --git a/bzlib.cabal b/bzlib.cabal
index b844743..5ec42fa 100644
--- a/bzlib.cabal
+++ b/bzlib.cabal
@@ -1,5 +1,5 @@
name: bzlib
-version: 0.5.0.5
+version: 0.5.0.6
copyright: (c) 2006-2015 Duncan Coutts
license: BSD3
license-file: LICENSE
@@ -30,7 +30,7 @@ library
Codec.Compression.BZip.Internal
other-modules: Codec.Compression.BZip.Stream
extensions: CPP, ForeignFunctionInterface
- build-depends: base >= 3 && < 4.14,
+ build-depends: base >= 3 && < 4.15,
bytestring == 0.9.* || == 0.10.*
includes: bzlib.h
ghc-options: -Wall
--
2.25.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment