[Haskell-cafe] blaze-builder and FlexibleInstances in code that aims to become part of the Haskell platform
iridcode at gmail.com
Fri May 20 09:46:30 CEST 2011
2011/5/20 Bas van Dijk <v.dijk.bas at gmail.com>:
> On 19 May 2011 10:53, Johan Tibell <johan.tibell at gmail.com> wrote:
>> Long term we'd like to switch bytestring over
>> from ForeignPtr to ByteArray#, if possible. There are currently some
>> technical obstacles to such a switch
> BTW I'm working with Roman Leshchinskiy to create the
> vector-bytestring package which provides:
> type ByteString = Data.Vector.Storable.Vector Word8
> and exports the same API as the bytestring package (no support for
> lazy bytestrings yet)
> A storable vector still uses a ForeignPtr but maybe this will make the
> switch to unboxed Vectors (which use ByteArray#) easier.
> Expect some code to be up somewhere next week.
OK, that sounds interesting. I'm looking forward to your code.
One trick, I'm using in the blaze-builder implementation is that the
current buffer is denoted by a region (pf :: Ptr Word8, pe :: Ptr
Word8) of the next free byte `pf` and the first byte after the buffer
`pe`. This only works for pinned ByteArrays/ForeignPtrs. Do you know
what the cost of such an array/foreignptr is? Moreover, after creation
I could "unpin" the array. Do you perhaps know if thats possible in
More information about the Haskell-Cafe