RE: [Haskell-cafe] FastString a misnomer

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

Hello Simon, Friday, October 21, 2005, 4:25:11 PM, you wrote:
Ok, so a rough structure of the final lib would be:
Data Data System | | | ByteArray (?) PackedString Posix | | | UTF8 Latin1 ... MMap (providing mmapFile :: FilePath -> ByteArray)
SM> Remind me what Data.ByteArray is for? Seems like it would overlap a lot SM> with Data.PackedString.Latin1 and UArray Word8. it is a List-like interface to immutable unboxed arrays with 0-based indexing, which will be used in PackedString.Latin1, PackedString.UTF8 and, if this type will be parameterized with base type, as i suggested - in all other PackedString implementations and will be also useful for other libs/apps ... btw, faking List interface is a "poor man classes" solution. at least in Haskell 2 we need to create Collection classes hierarchy. even C++ has such beast! -- Best regards, Bulat mailto:bulatz@HotPOP.com

simonmar:
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 :-)
Yep, ok. This goes on my todo list. Ok, perhaps more like: Data System | | PackedString Posix | | \ | Latin1 UTF8 UTF16 MMap as per the current 'packedstring' of SimonM's, with the fuller interface provided by FPS though. This was the basic plan from the start, anyway. -- Don
participants (3)
-
Bulat Ziganshin
-
dons@cse.unsw.edu.au
-
Simon Marlow