[Haskell-cafe] Re: String vs ByteString
Kevin Jardine
kevinjardine at gmail.com
Fri Aug 13 16:51:34 EDT 2010
Hi Don,
With respect, I disagree with that approach.
Almost every modern programming language has one or at most two
standard representations for strings.
That includes PHP, Python, Ruby, Perl and many others. The lack of a
standard text representation in Haskell has created a crazy patchwork
of incompatible libraries requiring explicit and often inefficient
conversions to connect them together.
I expect Haskell to be higher level than those other languages so that
I can ignore the lower level details and focus on the algorithms. But
in fact the string issue forces me to deal with lower level details
than even PHP requires. I end up with a program littered with ugly
pack, unpack, toString, fromString and similar calls.
That just doesn't feel right to me.
Kevin
On Aug 13, 10:39 pm, Don Stewart <d... at galois.com> wrote:
> There are many libraries for many purposes.
>
> How to pick your string library in Haskell
> http://blog.ezyang.com/2010/08/strings-in-haskell/
>
> kevinjardine:
>
> > I find it disturbing that a modern programming language like Haskell
> > still apparently forces you to choose between a representation for
> > "mostly ASCII text" and Unicode.
>
> > Surely efficient Unicode text should always be the default? And if the
> > Unicode format used by the Text library is not efficient enough then
> > can't that be fixed?
>
> > Cheers,
> > Kevin
>
> > On Aug 13, 10:28�pm, Ketil Malde <ke... at malde.org> wrote:
> > > Johan Tibell <johan.tib... at gmail.com> writes:
> > > > Here's a rule of thumb: If you have binary data, use Data.ByteString. If you
> > > > have text, use Data.Text.
>
> > > If you have a large amount of mostly ASCII text, use ByteString, since
> > > Data.Text uses twice the storage. �Also, ByteString might make more
> > > sense if the data is in a byte-oriented encoding, and the cost of
> > > encoding and decoding utf-16 would be significant.
>
> > > -k
> > > --
> > > If I haven't seen further, it is by standing in the footprints of giants
> > > _______________________________________________
> > > Haskell-Cafe mailing list
> > > Haskell-C... at haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-C... at haskell.org
> >http://www.haskell.org/mailman/listinfo/haskell-cafe
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-C... at haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list