I had an idea for a way to attach small-but-necessary amounts of
information to a ByteArray# or MutableByteArray# (and potentially also
to Array# and ArrayArray#). The type would look something like
This, for instance, would represent the address of a primitive array
of bytes, with an alignment of 8, and with the last 3 bits having a
number between 0 and 7 in them. Code to access the elements of the
ByteArray# would disregard the last bits, and the garbage collector
would simply ensure that the tag was retained after collection passes.
"ByteArray#" itself would simply become an alias for "TaggedByteArray#
1#", and the existing functions would have their types changed to work
with the new TaggedByteArray#s.
The primary potential problems I see are how to have a KnownNat-style
typeclass before Integer is defined, and how to store both the array
and the tag in an ArrayArray#.
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.