[Haskell-cafe] Bytestrings and [Char]

Lennart Augustsson lennart at augustsson.net
Mon Mar 22 12:20:46 EDT 2010


Turn on OverloadedStrings and you can pattern match on any type you
like that is in the IsString class.
Which means that Data.Text can use string literals just like regular
strings (but you can't use Char literals in the match).

On Mon, Mar 22, 2010 at 1:15 PM, Ivan Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> On 23 March 2010 00:10, Johan Tibell <johan.tibell at gmail.com> wrote:
>> A sequence of bytes is not the same thing as a sequence of Unicode
>> code points. If you want to replace String by something more efficient
>> have a look at Data.Text.
>
> Though Data.Text still has the disadvantage of not being as nice to
> deal with as String, since you can't pattern match on it, etc.
>
> Whilst it may degrade performance, treating String as a list of
> characters rather than an array provides you with greater flexibility
> of how to deal with it.
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> IvanMiljenovic.wordpress.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list