binary 0.7.5.0 → 0.7.6.0
raw patch · 9 files changed
+165/−14 lines, 9 filesdep ~basedep ~bytestringPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, bytestring
API changes (from Hackage documentation)
- Data.Binary.Put: instance Applicative PutM
- Data.Binary.Put: instance Functor PutM
- Data.Binary.Put: instance Monad PutM
+ Data.Binary.Put: instance [safe] Applicative PutM
+ Data.Binary.Put: instance [safe] Functor PutM
+ Data.Binary.Put: instance [safe] Monad PutM
Files
- binary.cabal +2/−2
- changelog.md +102/−0
- src/Data/Binary/Builder/Base.hs +1/−0
- src/Data/Binary/Builder/Internal.hs +2/−2
- src/Data/Binary/Class.hs +25/−2
- src/Data/Binary/Generic.hs +2/−1
- src/Data/Binary/Get.hs +0/−2
- src/Data/Binary/Put.hs +4/−3
- tests/QC.hs +27/−2
binary.cabal view
@@ -1,5 +1,5 @@ name: binary-version: 0.7.5.0+version: 0.7.6.0 license: BSD3 license-file: LICENSE author: Lennart Kolmodin <kolmodin@gmail.com>@@ -20,7 +20,7 @@ cabal-version: >= 1.8 tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.2, GHC == 7.10.1 extra-source-files:- README.md docs/hcar/binary-Lb.tex tools/derive/*.hs+ README.md changelog.md docs/hcar/binary-Lb.tex tools/derive/*.hs -- from the benchmark 'bench' extra-source-files:
+ changelog.md view
@@ -0,0 +1,102 @@+binary+======++binary-0.7.6.0+--------------++- Added binary instance for GHC.Fingerprint (from GHC >= 7.4).++binary-0.7.5.0+--------------++- Fix performance bug that was noticable when you get a big strict ByteString+ and the input to the decoder consists of many small chunks.+ - https://github.com/kolmodin/binary/issues/73+ - https://github.com/kolmodin/binary/pull/76+- Fix memory leak when decoding Double and Float.+ - Commit 497a181c083fa9faf7fa3aa64d1d8deb9ac76ecb+- We now require QuickCheck >= 2.8. Remove our version of arbitrarySizedNatural.++binary-0.7.4.0+--------------++- Some invalid UTF-8 strings caused an exception when decoded. Those errors will+ now now fail in the Get monad instead. See #70.+ Patch contributed by @ttuegel.++binary-0.7.3.0+--------------++- Add Binary instance for Natural (only with base > 4.8).++binary-0.7.2.3+--------------++- Remove INLINEs from GBinary/GSum methods. These interact very badly with the+ GHC 7.9.x simplifier. See also;+ - https://github.com/kolmodin/binary/pull/62+ - https://ghc.haskell.org/trac/ghc/ticket/9630+ - https://ghc.haskell.org/trac/ghc/ticket/9583++binary-0.7.2.2+--------------++- Make import of GHC.Base future-proof (https://github.com/kolmodin/binary/pull/59).++binary-0.7.2.1+--------------++- Fix to compile on GHC 6.10.4 and older (https://github.com/kolmodin/binary/issues/55).++binary-0.7.2.0+--------------++- Add `isolate :: Int -> Get a -> Get a`.+- Add `label :: String -> Get a -> Get a`.++binary-0.7.1.0+--------------++- Add `lookAheadE :: Get (Either a b) -> Get (Either a b)`.+- Add MonadPlus instance for Get. +++binary-0.7.0.1+--------------++- Updates to documentation.++binary-0.7.0.0+--------------++- Add `lookAhead :: Get a -> Get a`.+- Add `lookAheadM :: Get (Maybe a) -> Get (Maybe a)`.+- Add Alternative instance for Get (provides `<|>`).+- Add `decodeOrFail :: Binary a => L.ByteString -> Either (L.ByteString, ByteOffset, String) (L.ByteString, ByteOffset, a)`+- Add `decodeFileOrFail :: Binary a => FilePath -> IO (Either (ByteOffset, String) a)`.+- Remove `Ord` class constraint from `Set` and `Map` Binary instances.++binary-0.6.4+------------++- Add `runGetOrFail :: Get a -> L.ByteString -> Either (L.ByteString, ByteOffset, String) (L.ByteString, ByteOffset, a)`.++binary-0.6.3+------------++- Documentation tweeks, internal restructuring, more tests.++binary-0.6.2+------------++- `some` and `many` more efficient.+- Fix bug where `bytesRead` returned the wrong value.+- Documentation improvements.++binary-0.6.1+------------++- Fix bug where a decoder could return with `Partial` after the previous reply was `Nothing`.++binary-0.6.0.0+--------------
src/Data/Binary/Builder/Base.hs view
@@ -87,6 +87,7 @@ import GHC.Word (uncheckedShiftRL64#) # endif #endif+import Prelude -- Silence AMP warning. ------------------------------------------------------------------------
src/Data/Binary/Builder/Internal.hs view
@@ -1,13 +1,13 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 701-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | -- Module : Data.Binary.Builder.Internal -- Copyright : Lennart Kolmodin, Ross Paterson -- License : BSD3-style (see LICENSE)--- +-- -- Maintainer : Lennart Kolmodin <kolmodin@gmail.com> -- Stability : experimental -- Portability : portable to Hugs and GHC
src/Data/Binary/Class.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE CPP, FlexibleContexts #-} #if __GLASGOW_HASKELL__ >= 701-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-} #endif #ifdef GENERICS {-# LANGUAGE DefaultSignatures #-}@@ -10,6 +10,10 @@ #define HAS_NATURAL #endif +#if __GLASGOW_HASKELL__ >= 704+#define HAS_GHC_FINGERPRINT+#endif+ ----------------------------------------------------------------------------- -- | -- Module : Data.Binary.Class@@ -37,12 +41,13 @@ ) where import Data.Word+import Data.Bits+import Data.Int import Data.Binary.Put import Data.Binary.Get import Control.Monad-import Foreign import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as L@@ -77,6 +82,10 @@ import qualified Data.Foldable as Fold #endif +#ifdef HAS_GHC_FINGERPRINT+import GHC.Fingerprint+#endif+ ------------------------------------------------------------------------ #ifdef GENERICS@@ -583,3 +592,17 @@ n <- get xs <- getMany n return (listArray bs xs)++------------------------------------------------------------------------+-- Fingerprints++#ifdef HAS_GHC_FINGERPRINT+instance Binary Fingerprint where+ put (Fingerprint x1 x2) = do+ put x1+ put x2+ get = do+ x1 <- get+ x2 <- get+ return $! Fingerprint x1 x2+#endif
src/Data/Binary/Generic.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE BangPatterns, CPP, FlexibleInstances, KindSignatures,- ScopedTypeVariables, Trustworthy, TypeOperators, TypeSynonymInstances #-}+ ScopedTypeVariables, Safe, TypeOperators, TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -----------------------------------------------------------------------------@@ -26,6 +26,7 @@ import Data.Bits import Data.Word import GHC.Generics+import Prelude -- Silence AMP warning. -- Type without constructors instance GBinary V1 where
src/Data/Binary/Get.hs view
@@ -203,8 +203,6 @@ import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.Internal as L -import Control.Applicative- import Data.Binary.Get.Internal hiding ( Decoder(..), runGetIncremental ) import qualified Data.Binary.Get.Internal as I
src/Data/Binary/Put.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 701-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-} #endif -----------------------------------------------------------------------------@@ -8,7 +8,7 @@ -- Module : Data.Binary.Put -- Copyright : Lennart Kolmodin -- License : BSD3-style (see LICENSE)--- +-- -- Maintainer : Lennart Kolmodin <kolmodin@gmail.com> -- Stability : stable -- Portability : Portable to Hugs and GHC. Requires MPTCs@@ -62,11 +62,12 @@ import qualified Data.ByteString.Lazy as L import Control.Applicative+import Prelude -- Silence AMP warning. ------------------------------------------------------------------------ --- XXX Strict in buffer only. +-- XXX Strict in buffer only. data PairS a = PairS a !Builder sndS :: PairS a -> Builder
tests/QC.hs view
@@ -5,10 +5,14 @@ #define HAS_NATURAL #endif +#if __GLASGOW_HASKELL__ >= 704+#define HAS_GHC_FINGERPRINT+#endif+ import Control.Applicative import Control.Exception as C (SomeException, catch, evaluate)-import Control.Monad (unless)+import Control.Monad (unless, liftM2) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.Internal as L@@ -20,6 +24,10 @@ import Numeric.Natural #endif +#ifdef HAS_GHC_FINGERPRINT+import GHC.Fingerprint+#endif+ import Test.Framework import Test.Framework.Providers.QuickCheck2 import Test.QuickCheck@@ -376,6 +384,20 @@ ------------------------------------------------------------------------ +#ifdef HAS_GHC_FINGERPRINT+prop_test_GHC_Fingerprint :: Property+prop_test_GHC_Fingerprint = forAll gen test+ where+ gen :: Gen Fingerprint+ gen = liftM2 Fingerprint arbitrary arbitrary+#if !MIN_VERSION_base(4,7,0)+instance Show Fingerprint where+ show (Fingerprint x1 x2) = show (x1,x2)+#endif+#endif++------------------------------------------------------------------------+ type T a = a -> Property type B a = a -> Bool @@ -454,7 +476,10 @@ , ("Int", p (test :: T Int )) , ("Integer", p (test :: T Integer )) #ifdef HAS_NATURAL- , ("Natural", (prop_test_Natural :: Property ))+ , ("Natural", prop_test_Natural )+#endif+#ifdef HAS_GHC_FINGERPRINT+ , ("GHC.Fingerprint", prop_test_GHC_Fingerprint ) #endif , ("Float", p (test :: T Float ))