binary-strict 0.4.8.5 → 0.4.8.6
raw patch · 5 files changed
+38/−7 lines, 5 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- binary-strict.cabal +3/−3
- src/Data/Binary/Strict/BitGet.hs +8/−0
- src/Data/Binary/Strict/Class.hs +11/−4
- src/Data/Binary/Strict/Get.hs +8/−0
- src/Data/Binary/Strict/IncrementalGet.hs +8/−0
binary-strict.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: binary-strict-version: 0.4.8.5+version: 0.4.8.6 synopsis: Binary deserialisation using strict ByteStrings description: This is a strict version of the Get monad from the binary package. It's pretty much just a copy and paste job@@ -34,7 +34,7 @@ FlexibleInstances, MultiParamTypeClasses, UndecidableInstances- build-depends: base >=4.12 && <4.13,+ build-depends: base >=4.12 && <4.15, bytestring >=0.10 && <0.11, mtl >=2.2 && <2.3, array >=0.5 && <0.6@@ -44,7 +44,7 @@ Test-Suite test type: exitcode-stdio-1.0 main-is: tests/BitGetTest.hs- build-depends: base >=4.12 && <4.13,+ build-depends: base >=4.12 && <4.15, bytestring >=0.10 && <0.11, binary-strict default-language: Haskell2010
src/Data/Binary/Strict/BitGet.hs view
@@ -95,7 +95,15 @@ m >>= k = BitGet (\s -> case unGet m s of (Left err, s') -> (Left err, s') (Right a, s') -> unGet (k a) s')+#ifdef MIN_VERSION_GLASGOW_HASKELL+#if MIN_VERSION_GLASGOW_HASKELL(8,8,0,0)++instance MonadFail BitGet where fail err = BitGet (\s -> (Left err, s))+#else+ fail err = BitGet (\s -> (Left err, s))+#endif+#endif -- | Run a BitGet on a ByteString runBitGet :: B.ByteString -> BitGet a -> Either String a
src/Data/Binary/Strict/Class.hs view
@@ -1,18 +1,25 @@+{-# LANGUAGE CPP #-} -- | This module contains a single class which abstracts over Get and -- IncrementalGet, so that one can write parsers which work in both. -- If you are using this module, you may find that -- -fno-monomorphism-restriction is very useful. module Data.Binary.Strict.Class where -import Control.Applicative (Alternative, (<|>))+import Control.Applicative (Alternative, (<|>)) -import qualified Data.ByteString as B-import Data.Word+import qualified Data.ByteString as B+import Data.Word -- | This is the generic class for the set of binary parsers. This lets you -- write parser functions which are agnostic about the pattern of parsing -- in which they get used (incremental, strict, bitwise etc)+#ifdef MIN_VERSION_GLASGOW_HASKELL+#if MIN_VERSION_GLASGOW_HASKELL(8,8,0,0)+class (Monad m, MonadFail m, Alternative m) => BinaryParser m where+#else class (Monad m, Alternative m) => BinaryParser m where+#endif+#endif skip :: Int -> m () bytesRead :: m Int remaining :: m Int@@ -60,7 +67,7 @@ result <- many p case result of [] -> fail ""- x -> return x+ x -> return x optional :: m a -> m (Maybe a) optional p = (p >>= return . Just) <|> return Nothing
src/Data/Binary/Strict/Get.hs view
@@ -116,7 +116,15 @@ m >>= k = Get (\s -> case unGet m s of (Left err, s') -> (Left err, s') (Right a, s') -> unGet (k a) s')+#ifdef MIN_VERSION_GLASGOW_HASKELL+#if MIN_VERSION_GLASGOW_HASKELL(8,8,0,0)++instance MonadFail Get where fail err = Get (\s -> (Left err, s))+#else+ fail err = Get (\s -> (Left err, s))+#endif+#endif get :: Get S get = Get (\s -> (Right s, s))
src/Data/Binary/Strict/IncrementalGet.hs view
@@ -143,7 +143,15 @@ instance Monad (Get r) where return a = Get (\s -> \k -> k a s) m >>= k = Get (\s -> \cont -> unGet m s (\a -> \s' -> unGet (k a) s' cont))+#ifdef MIN_VERSION_GLASGOW_HASKELL+#if MIN_VERSION_GLASGOW_HASKELL(8,8,0,0)++instance MonadFail (Get r) where fail err = Get (\s -> const $ IFailed s err)+#else+ fail err = Get (\s -> const $ IFailed s err)+#endif+#endif get :: Get r S get = Get (\s -> \k -> k s s)