Module documentation for 0.5.1.2
The ‘store’ package provides efficient binary serialization. There are a couple features that particularly distinguish it from most prior Haskell serialization libraries:
Its primary goal is speed. By default, direct machine representations are used for things like numeric values (
Word32, etc) and buffers (
Vector, etc). This means that much of serialization uses the equivalent of
Instead of implementing lazy serialization / deserialization involving multiple input / output buffers,
pokealways work with a single buffer. This buffer is allocated by asking the value for its size before encoding. This simplifies the encoding logic, and allows for highly optimized tight loops.
storecan optimize size computations by knowing when some types always use the same number of bytes. This allows us to compute the byte size of a
Vector Int32by just doing
length v * 4.
It also features:
Optimized serialization instances for many types from base, vector, bytestring, text, containers, time, template-haskell, and more.
TH and GHC Generics based generation of Store instances for datatypes
TH generation of testcases.
Utilities for streaming encoding / decoding of Store encoded messages, via the
- Fixes compilation with GHC < 8.0. See #142.
- Update to the instances for generics, to improve error messages for sum types with more than 255 constructors. See #141
Update to TH to support sum types with more than 62 constructors.
Uses TH to derive Either instance, so that it can sometimes have ConstSize #119.
- Updates to test-suite enabling
storeto build with newer dependencies.
Data.Store.Streamingmoved to a separate package,
Buildable with GHC 8.2
Fix to haddock formatting of Data.Store.TH code example
- Fixed compilation on GHC 7.8
- Less aggressive inlining, resulting in faster compilation / simplifier not running out of ticks
- Fixed testsuite
Breaking change in the encoding of Map / Set / IntMap / IntSet, to use ascending key order. Attempting to decode data written by prior versions of store (and vice versa) will almost always fail with a decent error message. If you’re unlucky enough to have a collision in the data with a random Word32 magic number, then the error may not be so clear, or in extremely rare cases, successfully decode, yielding incorrect results. See #97 and #101.
Performance improvement of the ‘Peek’ monad, by introducing more strictness. This required a change to the internal API.
API and behavior of ‘Data.Store.Version’ changed. Previously, it would check the version tag after decoding the contents. It now also stores a magic Word32 tag at the beginning, so that it fails more gracefully when decoding input that lacks encoded version info.
Deprecated in favor of 0.4.1
Fix to derivation of primitive vectors, only relevant when built with primitive-0.6.2.0 or later
Removes INLINE pragmas on the generic default methods. This dramatically improves compilation time on recent GHC versions. See #91.
instance Contravariant Size
Uses store-core-0.3.*, which has support for alignment sensitive architectures.
Adds support for streaming decode from file descriptor, not supported on windows. As part of this addition, the API for “Data.Store.Streaming” has changed.
- Fixes a bug that could could result in attempting to malloc a negative number of bytes when reading corrupted data.
- Fixes a bug that could result in segfaults when reading corrupted data.
- Adds experimental
Data.Store.TypeHash. The new functionality is similar to TypeHash, but there are much fewer false positives of hashes changing.
- Now exports types related to generics
- Core functionality split into
Streaming support now prefixes each Message with a magic number, intended to detect mis-alignment of data frames. This is worth the overhead, because otherwise serialization errors could be more catastrophic - interpretting some bytes as a length tag and attempting to consume many bytes from the source.
weigh based allocations benchmark.
Streaming support now has checks for over/undershooting buffer
- First public release