MIT licensed
Maintained by Michael Sloan
This version can be pinned in stack with:store-0.3@sha256:ca08e8ab6ae852332784325653f288fa9ae644ac694b58edd98da8cf7abf2858,7113

store

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 (Int, Double, Word32, etc) and buffers (Text, ByteString, Vector, etc). This means that much of serialization uses the equivalent of memcpy.

    We have plans for supporting architecture independent serialization - see #36 and #31. This plan makes little endian the default, so that the most common endianness has no overhead.

  • Instead of implementing lazy serialization / deserialization involving multiple input / output buffers, peek an poke always 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.

  • store can 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 Int32 by 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.

Blog posts

Changes

ChangeLog

0.3

  • 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.

0.2.1.2

  • Fixes a bug that could could result in attempting to malloc a negative number of bytes when reading corrupted data.

0.2.1.1

  • Fixes a bug that could result in segfaults when reading corrupted data.

0.2.1.0

Release notes:

  • Adds experimental Data.Store.Version and deprecates Data.Store.TypeHash. The new functionality is similar to TypeHash, but there are much fewer false positives of hashes changing.

Other enhancements:

  • Now exports types related to generics

0.2.0.0

Release notes:

  • Core functionality split into store-core package

Breaking changes:

  • combineSize' renamed to combineSizeWith

  • 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.

Other enhancements:

  • weigh based allocations benchmark.

  • Addition of Array / UArray instances

  • Streaming support now has checks for over/undershooting buffer

Bug fixes:

0.1.0.0

  • First public release