[Haskell-cafe] lazy boxed array and builder?

Bas van Dijk v.dijk.bas at gmail.com
Thu Jul 12 15:52:42 CEST 2012

On 12 July 2012 15:35, Yves Parès <yves.pares at gmail.com> wrote:
> I remember this discussion, lazy vectors would also enable an implementation
> of bytestring and (maybe) text only with unboxed vectors, unifying it all:
> type ByteString = Vector Word8

Yes, I would like to add a lazy storable vector to
vector-bytestring[1] to make the API 100% consistent with bytestring.

Ideally we would have a type like:

data Lazy vector a = Empty | Chuck {-# UNPACK #-} !(vector a) (Lazy vector a)

Unfortunately GHC can't unpack polymorphic fields. The next best thing
is to use a type family which for each type of vector would return its
lazy version (where the vector is unpacked in the cons cell). Then we
would need a class for common operations on those lazy vectors.



[1] http://hackage.haskell.org/package/vector-bytestring

More information about the Haskell-Cafe mailing list