Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Codec/Compression/BZip/Stream.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -228,25 +228,26 @@ instance Functor Stream where
fmap = liftM

instance Applicative Stream where
pure = return
pure = pureZ
(<*>) = ap
(*>) = thenZ_

instance Monad Stream where
(>>=) = thenZ
-- m >>= f = (m `thenZ` \a -> consistencyCheck `thenZ_` returnZ a) `thenZ` f
(>>) = thenZ_
return = returnZ
(>>) = (*>)
return = pure
#if !MIN_VERSION_base(4,13,0)
fail = Fail.fail
#endif

instance Fail.MonadFail Stream where
fail = (finalise >>) . failZ

returnZ :: a -> Stream a
returnZ a = BZ $ \_ inBuf outBuf outOffset outLength ->
pureZ :: a -> Stream a
pureZ a = BZ $ \_ inBuf outBuf outOffset outLength ->
return (inBuf, outBuf, outOffset, outLength, a)
{-# INLINE returnZ #-}
{-# INLINE pureZ #-}

thenZ :: Stream a -> (a -> Stream b) -> Stream b
thenZ (BZ m) f =
Expand Down
8 changes: 4 additions & 4 deletions bzlib.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: bzlib
version: 0.5.1.0
version: 0.6.0.0
copyright: (c) 2006-2015 Duncan Coutts
license: BSD3
license-file: LICENSE
Expand Down Expand Up @@ -30,16 +30,16 @@ source-repository head
source-repository this
type: git
location: https://github.com/hackage-trustees/bzlib.git
tag: 0.5.1.0
tag: 0.6.0.0

library
default-language: Haskell2010
exposed-modules: Codec.Compression.BZip,
Codec.Compression.BZip.Internal
other-modules: Codec.Compression.BZip.Stream
default-extensions: CPP, ForeignFunctionInterface
build-depends: base >= 4.3 && < 4.16,
bytestring == 0.9.* || == 0.10.*
build-depends: base >= 4.3 && < 5,
bytestring >= 0.9.0 && < 0.12
if !impl(ghc >=8.0)
build-depends: fail ==4.9.*
includes: bzlib.h
Expand Down