[Haskell-cafe] FastString a misnomer

Bulat Ziganshin bulatz at HotPOP.com
Fri Oct 21 03:11:51 EDT 2005


Hello Donald,

Friday, October 21, 2005, 5:52:32 AM, you wrote:

DBS> Ok, so a rough structure of the final lib would be:

DBS>     Data                Data                   System
DBS>     |                   |                      |
DBS>     ByteArray (?)       PackedString           Posix
DBS>                         |      |               |
DBS>                         UTF8   Latin1 ...      MMap (providing mmapFile :: FilePath -> ByteArray)

i propose to make separate library with UTF8 packing/unpacking
routines. for example, i can someday create library for 0-ended
utf8-encoded strings, which will require this UTF8 lib. also, someday
we will need UTF16 packing/unpacking library to deal with windows
wide-string apis 

also, how about implementing general "Vector a" type instead of
ByteArray? it will be helpful in making 2/4-byte PackedStrings, and
moreover - it will be interesting for other applications

data Vector a = Vector !Int !(ForeignPtr a)
null = ...
reverse = ...

data PS_UTF8 = PS_UTF8 (Vector Word8) !Int  -- as John Meacham suggested
type PS_Latin1 = Vector Word8        -- all functions are already implemented!
type PS_UCS2   = Vector Word16       -- ditto

-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list