On Thu, 2008-02-21 at 10:06 +0100, Johan Tibell wrote:
> Hi John!
> 
> On Wed, Feb 20, 2008 at 3:39 PM, John Goerzen <[EMAIL PROTECTED]> wrote:
> >  3) Would it make sense to base as much code as possible in the Haskell
> >    core areound ListLike definitions?  Here I think of functions such
> >    as lines and words, which make sense both on [Char] as well as
> >    ByteStrings.
> 
> I don't think the examples you gave (i.e. lines and words) make much
> sense on ByteStrings. You would have to assume that the sequence of
> bytes are in some particular Unicode encoding and thus words and lines
> will break if they get passed a ByteString using a different encoding.
> I don't think either of those two functions make sense on anything but
> sequence of character types like String.

That's exactly what the Data.ByteString[.Lazy].Char8 modules provide, a
Char8 view of a Bytestring. Those modules provide functions like words,
lines etc that assume an ASCII compatible 8bit encoding.

One day we'll have a separate type that does Unicode with a similar fast
packed representation.

Duncan

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to