My understanding is that ByteString
s are just lists of vectors of Word8
s. 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.
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
If you only want the "strict" versions use vector which is part of the platform. Vector has both unboxed and (fully generic) boxed variants. Vector also includes agressive high quality stream fusion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With