[Haskell-cafe] The Proliferation of List-Like Types

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Feb 21 05:37:16 EST 2008

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 <jgoerzen at complete.org> 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.


More information about the Haskell-Cafe mailing list