[Haskell-cafe] FastString a misnomer

Simon Marlow simonmar at microsoft.com
Fri Oct 21 08:25:11 EDT 2005


On 21 October 2005 02:53, Donald Bruce Stewart wrote:

> john:
>> On Thu, Oct 20, 2005 at 10:45:28AM +0100, Simon Marlow wrote:
>>> I think when this is ready it should replace Data.PackedString.
>>> 
>>> I don't necessarily mean put it into fptools/libraries/base - we
>>> could just remove the existing Data.PackedString from there and
>>> your separate package can provide Data.PackedString.  That is,
>>> unless we decide to use it in GHC in some way, in which case we'll
>>> have to pull (a copy of) it into fptools/libraries.
>> 
>> We should make 'PackedString' the UTF8 wrapper though and provide
>> Data.ByteArray as a separate library. If it has string in the name,
>> one should be able to replace strings with it everywhere and expect
>> the right thing to happen as enforced by the type system. that and
>> C's conflation of characters and bytes and Haskell 98s lack of
>> clearing up the issue has been a huge pet peeve of mine.
> 
> Ok, so a rough structure of the final lib would be:
> 
>     Data                Data                   System
>     |                   |                      |
>     ByteArray (?)       PackedString           Posix
>                         |      |               |
>                         UTF8   Latin1 ...      MMap (providing
> mmapFile :: FilePath -> ByteArray) 

Remind me what Data.ByteArray is for?  Seems like it would overlap a lot
with Data.PackedString.Latin1 and UArray Word8.

We should have Data.PackedString.UTF16 too; it'll make interoperating
with Win32 APIs easier as Bulat pointed out.

I like John Meacham's suggestion of changing the UTF8 representation to
include a count of characters as well as bytes.  I'm not volunteering to
do it, just adding my "+1" in case anyone else wanted to :-)

Cheers,
	Simon



More information about the Haskell-Cafe mailing list