[Haskell] Re: ANNOUNCE: FPS - FastPackedStrings 0.2

Ashley Yakeley ashley at semantic.org
Thu Apr 20 16:16:24 EDT 2006


Tomasz Zielonka wrote:

> I think the biggest barrier to using Word8 operations on String-like
> types is the Read/Show instance for Word8, which works like for other
> Word types:
> 
>   Prelude Data.Word> map (toEnum . fromEnum) "Haskell" :: [Word8]
>   [72,97,115,107,101,108,108]

But FastPackedString is in fact a fast packed [Word8]. I am in favour of 
Word8 operations on [Word8]-like types.

If you then wish to encode something (be it text, XML, video or 
whatever) in those bytes, you should do so explicitly. Picking one 
particular type (String) with one particular encoding (presumably 
Latin-1) is just the sort of thing that leads to text encoding errors 
and the kind of general programmer confusion over types that Haskell is 
supposed to prevent.

-- 
Ashley Yakeley, Seattle WA
WWED? http://www.cs.utexas.edu/users/EWD/



More information about the Haskell mailing list