packages feed

compact 0.1.0.1 → 0.2.0.0

raw patch · 4 files changed

+34/−13 lines, 4 filesdep ~basedep ~binarydep ~bytestringnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, binary, bytestring

API changes (from Hackage documentation)

- Data.Compact: compact :: () => a -> IO Compact a
+ Data.Compact: compact :: () => a -> IO (Compact a)
- Data.Compact: compactAdd :: () => Compact b -> a -> IO Compact a
+ Data.Compact: compactAdd :: () => Compact b -> a -> IO (Compact a)
- Data.Compact: compactAddWithSharing :: () => Compact b -> a -> IO Compact a
+ Data.Compact: compactAddWithSharing :: () => Compact b -> a -> IO (Compact a)
- Data.Compact: compactSized :: () => Int -> Bool -> a -> IO Compact a
+ Data.Compact: compactSized :: () => Int -> Bool -> a -> IO (Compact a)
- Data.Compact: compactWithSharing :: () => a -> IO Compact a
+ Data.Compact: compactWithSharing :: () => a -> IO (Compact a)
- Data.Compact: data Compact a :: * -> *
+ Data.Compact: data Compact a

Files

ChangeLog.md view
@@ -1,5 +1,14 @@ # Revision history for compact +## 0.2.0.0  -- 2020-04-13++* Bounds bumps+* Add magic number to serialisation encoding++## 0.1.0.1  -- 2017-02-27++* A bit of cleanup.+ ## 0.1.0.0  -- 2017-02-27  * First version.
Data/Compact/Serialize.hs view
@@ -2,7 +2,6 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE GADTs #-}-{-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -14,7 +13,6 @@ import Type.Reflection import Control.Monad import Data.Monoid-import Data.IORef import Data.Word import System.IO @@ -23,10 +21,7 @@ import Foreign.Marshal.Alloc  import qualified Data.Binary as B-import qualified Data.ByteString as BS-import qualified Data.ByteString.Unsafe as BSU import qualified Data.ByteString.Lazy as BSL-import qualified Data.ByteString.Builder as BSB  import GHC.Compact import GHC.Compact.Serialized@@ -37,13 +32,21 @@ -- ghc-compact does not have a binary dependency instance (Typeable a) => B.Binary (CompactFile a) where     get = do+        magic <- B.get+        when (magic /= magicNumber) $+            fail "Data.Compact.Serialized: bad magic number"         SomeTypeRep tyrep <- B.get         case tyrep `eqTypeRep` typeRep @a of           Just HRefl -> CompactFile <$> getSerializedCompact           Nothing -> fail $             "Data.Compact.Serialized: expected " ++ show (typeRep @a) ++             " but got " ++ show tyrep-    put (CompactFile a) = B.put (typeRep @a) >> putSerializedCompact a+    put (CompactFile a) = B.put magicNumber >> B.put (typeRep @a) >> putSerializedCompact a++-- Serves as a very rudimentary integrity check.+-- Chosen at random by roll of a 2^64-sided die; it was a sight to behold.+magicNumber :: Word64+magicNumber = 0x7c155e7a53f094f2  putPtr :: Ptr a -> B.Put putPtr = B.put @Word64 . fromIntegral . ptrToWordPtr
README.md view
@@ -18,8 +18,8 @@ the region, you should see a speedup in your major GC runs.  This package is currently highly experimental, but we hope it may be useful to-some people.  It is GHC 8.2 only.  The bare-bones library that ships with GHC is-ghc-compact.+some people.  It is GHC 8.2 and later only.  The bare-bones library that ships+with GHC is `ghc-compact`.  ## Quick start 
compact.cabal view
@@ -1,5 +1,5 @@ name:                compact-version:             0.1.0.1+version:             0.2.0.0 synopsis:            Non-GC'd, contiguous storage for immutable data structures description:     This package provides user-facing APIs for working with@@ -11,8 +11,8 @@     released).      This package is currently highly experimental, but we hope it may-    be useful to some people.  It is GHC 8.2 only.  The bare-bones library-    that ships with GHC is ghc-compact.+    be useful to some people.  It is GHC 8.2 and later only.  +    The bare-bones library that ships with GHC is @ghc-compact@. license:             BSD3 license-file:        LICENSE author:              Edward Z. Yang, Ben Gamari@@ -24,15 +24,24 @@ extra-source-files:  ChangeLog.md cabal-version:       >=1.10 extra-source-files:  README.md tests/sample1.hs tests/sample2.hs+tested-with:         GHC==8.2.1, GHC==8.2.2,+                     GHC==8.4.1, GHC==8.4.2, GHC==8.4.3, GHC==8.4.4,+                     GHC==8.6.1, GHC==8.6.2, GHC==8.6.3, GHC==8.6.4, GHC==8.6.5,+                     GHC==8.8.1, GHC==8.8.2, GHC==8.8.3,+                     GHC==8.10.1 +source-repository head+  type:                git+  location:            https://github.com/ezyang/compact+ library   exposed-modules:     Data.Compact                        Data.Compact.Serialize-  build-depends:       base       >= 4.10 && < 4.11,+  build-depends:       base       >= 4.10 && < 4.15,                        ghc-compact,                        -- TODO: SomeTypeRep instance is in unreleased version                        -- of binary that is bundled with GHC dev branch-                       binary     >= 0.8.4.1 && < 0.9,+                       binary     >= 0.8.4.1 && < 0.11,                        bytestring >= 0.10 && < 0.11   default-language:    Haskell2010