diff --git a/.gitignore b/.gitignore index 02f82a6..4c9e245 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,23 @@ -.cabal-sandbox +dist +dist-* +cabal-dev +*.o +*.hi +*.hie +*.chi +*.chs.h +*.dyn_o +*.dyn_hi +.hpc +.hsenv +.cabal-sandbox/ cabal.sandbox.config -dist/ +*.prof +*.aux +*.hp +*.eventlog +.stack-work/ +cabal.project.local +cabal.project.local~ +.HTF/ +.ghc.environment.* diff --git a/Data/Binary/Bits/Get.hs b/Data/Binary/Bits/Get.hs index 7d910ac..af74de4 100644 --- a/Data/Binary/Bits/Get.hs +++ b/Data/Binary/Bits/Get.hs @@ -342,10 +342,12 @@ newtype BitGet a = B { runState :: S -> Get (S,a) } instance Monad BitGet where return x = B $ \s -> return (s,x) - fail str = B $ \(S inp n) -> putBackState inp n >> fail str (B f) >>= g = B $ \s -> do (s',a) <- f s runState (g a) s' +instance MonadFail BitGet where + fail str = B $ \(S inp n) -> putBackState inp n >> fail str + instance Functor BitGet where fmap f m = m >>= \a -> return (f a) @@ -467,13 +469,13 @@ shiftl_w32 :: Word32 -> Int -> Word32 shiftl_w64 :: Word64 -> Int -> Word64 #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) -shiftl_w8 (W8# w) (I# i) = W8# (w `uncheckedShiftL#` i) -shiftl_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftL#` i) -shiftl_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftL#` i) +shiftl_w8 (W8# w) (I# i) = W8# (wordToWord8# (word8ToWord# w `uncheckedShiftL#` i)) +shiftl_w16 (W16# w) (I# i) = W16# (wordToWord16# (word16ToWord# w `uncheckedShiftL#` i)) +shiftl_w32 (W32# w) (I# i) = W32# (wordToWord32# (word32ToWord# w `uncheckedShiftL#` i)) -shiftr_w8 (W8# w) (I# i) = W8# (w `uncheckedShiftRL#` i) -shiftr_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftRL#` i) -shiftr_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftRL#` i) +shiftr_w8 (W8# w) (I# i) = W8# (wordToWord8# (word8ToWord# w `uncheckedShiftRL#` i)) +shiftr_w16 (W16# w) (I# i) = W16# (wordToWord16# (word16ToWord# w `uncheckedShiftRL#` i)) +shiftr_w32 (W32# w) (I# i) = W32# (wordToWord32# (word32ToWord# w `uncheckedShiftRL#` i)) #if WORD_SIZE_IN_BITS < 64 diff --git a/Data/Binary/Bits/Put.hs b/Data/Binary/Bits/Put.hs index b1e9e1f..b7334b0 100644 --- a/Data/Binary/Bits/Put.hs +++ b/Data/Binary/Bits/Put.hs @@ -172,4 +172,4 @@ instance Monad BitPut where let PairS a s' = run m s PairS b s'' = run (k a) s' in PairS b s'' - return x = BitPut $ \s -> PairS x s + return = pure diff --git a/binary-bits.cabal b/binary-bits.cabal index 0129675..c8c61dd 100644 --- a/binary-bits.cabal +++ b/binary-bits.cabal @@ -13,12 +13,9 @@ build-type: Simple cabal-version: >=1.10 -source-repository head - type: git - location: git://github.com/kolmodin/binary-bits.git library - build-depends: base==4.*, binary >= 0.6.0.0, bytestring + build-depends: base >=4.17.2.1, binary >= 0.6.0.0, bytestring other-extensions: RankNTypes, MagicHash, BangPatterns, CPP