Search code examples
haskellbytestring

Is there a parametric version of lazy `ByteString`?


My understanding is that ByteStrings are just lists of vectors of Word8s. This packaging gives better memory and speed performance on binary streams. Similarly, the Text type boosts performance on Char streams.

But what if I have Int streams, or Double streams? Is there a parametric version of ByteString that is easy to use with different data types? I assume it would only make sense to use on unboxable types.


Solution

  • Vector is the go-to choice for strict arrays. StorableVector attempts to be a more ByteString-like interface, including lazy, chunked behavior, and I believe was even written originally as a generalization of the ByteString code: http://hackage.haskell.org/package/storablevector