From 71f71a517755fd63978da50e21d1d340357ca910 Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Wed, 1 May 2019 18:57:02 +0200 Subject: [PATCH] Add tentative support for upcoming&unreleased base-4.13.0.0 NB: `Stream` is an internal monad and so we don't need to bother with the `fail` compat package. --- Codec/Compression/Zlib/Stream.hsc | 16 ++++++++++++++++ changelog | 4 ++++ zlib.cabal | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Codec/Compression/Zlib/Stream.hsc b/Codec/Compression/Zlib/Stream.hsc index 04e1bbb..373ed7f 100644 --- a/Codec/Compression/Zlib/Stream.hsc +++ b/Codec/Compression/Zlib/Stream.hsc @@ -123,6 +123,9 @@ import Data.ByteString (ByteString) import Control.Applicative (Applicative(..)) #endif import Control.Monad (ap,liftM) +#if MIN_VERSION_base(4,9,0) +import qualified Control.Monad.Fail as Fail +#endif #if __GLASGOW_HASKELL__ >= 702 #if __GLASGOW_HASKELL__ >= 708 import Control.Monad.ST.Strict @@ -373,8 +376,21 @@ instance Monad Stream where (>>=) = thenZ -- m >>= f = (m `thenZ` \a -> consistencyCheck `thenZ_` returnZ a) `thenZ` f (>>) = (*>) + +#if !MIN_VERSION_base(4,8,0) return = pure +#endif + +#if !MIN_VERSION_base(4,9,0) fail = (finalise >>) . failZ +#elif !MIN_VERSION_base(4,13,0) + fail = Fail.fail +#endif + +#if MIN_VERSION_base(4,9,0) +instance Fail.MonadFail Stream where + fail = (finalise >>) . failZ +#endif returnZ :: a -> Stream a returnZ a = Z $ \_ inBuf outBuf outOffset outLength -> diff --git a/changelog b/changelog index c6baa5c..779a20a 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +0.6.2.1 TBD + +* Add support for GHC 8.8 / base-4.13 + 0.6.2 Herbert Valerio Riedel March 2018 * New cabal flag 'pkg-config' for discovering 'zlib` via pkg-config(1) (#16) diff --git a/zlib.cabal b/zlib.cabal index 58af827..9315d29 100644 --- a/zlib.cabal +++ b/zlib.cabal @@ -1,5 +1,5 @@ name: zlib -version: 0.6.2 +version: 0.6.2.1 copyright: (c) 2006-2016 Duncan Coutts license: BSD3 license-file: LICENSE