String != [Char]

Heinrich Apfelmus apfelmus at
Sat Mar 24 08:39:57 CET 2012

Edward Kmett wrote:
> Like I said, my objection to including Text is a lot less strong than
> my feelings on any notion of deprecating String.
> [..]
> The pedagogical concern is quite real, remember many introductory
> lanuage classes have time to present Haskell and the list data type
> and not much else. Showing parsing through pattern matching on
> strings makes a very powerful tool, its harder to show that with
> Text.
> [..]
> The major benefits of Text come from FFI opportunities, but even
> there if you dig into its internals it has to copy out of the array
> to talk to foreign functions because it lives in unpinned memory
> unlike ByteString.

I agree with Edward Kmett on the virtues of  String = [Char]  for 
learning Haskell. I'm teaching beginners regularly and it is simply 
eye-opening for them that they can use the familiar list operations to 
solve real world problems which usually involve textual data.

Which brings me to the fundamental question behind this proposal: Why do 
we need Text at all? What are its virtues and how do they compare? What 
is the trade-off? (I'm not familiar enough with the Text library to 
answer these.)

To put it very pointedly: is a %20 performance increase on the current 
generation of computers worth the cost in terms of ease-of-use, when the 
performance can equally be gained by buying a faster computer or more 
RAM? I'm not sure whether I even agree with this statement, but this is 
the trade-off we are deciding on.

Best regards,
Heinrich Apfelmus


More information about the Haskell-prime mailing list