[Haskell-cafe] Re: String vs ByteString

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Fri Aug 13 19:48:24 EDT 2010

Jason Dagit <dagit at codersbase.com> writes:

> On Fri, Aug 13, 2010 at 4:03 PM, Ivan Lazar Miljenovic <
>> So, the real issue here is that there is not yet a good abstraction over
>> what we consider to be textual data, and instead people have to code to
>> a specific data type.
> Isn't this the same problem we have with numeric literals?  I might even go
> so far as to suggest it's going to be a problem with all types of
> literals.

Not just literals; there is no common way of doing a character
replacement (e.g. map toUpper) in a textual type for example.

> Isn't it also a problem which is partially solved with the OverloadedStrings
> extension?
> http://haskell.cs.yale.edu/ghc/docs/6.12.2/html/users_guide/type-class-extensions.html#overloaded-strings

That just convert literals; it doesn't provide a common API.

> It seems like the interface exposed by ByteString could be in a type class.
>  At that point, would the problem be solved?

To a certain extent, yes.

There is no one typeclass that could cover everything (especially since
something as simple as toUpper won't work if I understand Bryan's ß ->
SS example), but it would help in the majority of cases.

There has been one attempt, but it doesn't seem very popular (tagsoup
has another, but it's meant to be internal only):

Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list