
On 05/18/2015 11:44 PM, Andrew Gibiansky wrote:
Hey all,
In the earlier haskell-cafe discussion of IsString, someone mentioned that it would be nice to abandon [Char] as the blessed string type in Haskell. I've thought about this on and off for a while now, and think that the fact that [Char] is the default string type is a really big issue (for example, it gives beginners the idea that Haskell is incredibly slow, because everything that involves string processing is using linked lists).
I am not proposing anything, but am curious as to what already has been discussed:
Just me few cents below.
1. Has the possibility of migrating away from [Char] been investigated before?
Migrating away to what?
2. What gains could we see in ease of use, performance, etc, if [Char] was deprecated?
Deprecated in favour of what?
3. What could replace [Char], while retaining the same ease of use for writing string manipulation functions (pattern matching, etc)?
ViewPatterns could let us imitate the pattern match at least but you'd still have to reconstruct from a list on RHS. Basically to me you're asking whether we can work with lists, using usual list things including constructors and presumably all list-y functions but without using lists… We either want one or another ;). But depending on what we want and if you're willing to give up the : and [] syntax, one could probably do well here anyway. But in any scenario, you'd be breaking every piece of code using String ever anyway.
4. Is there any sort of migration path that would make this change feasible in mainline Haskell in the medium term (2-5 years)?
I don't think we'll ever see String changed in any significant way by default unless great pains are taken to do so. As I mention, you'd probably be breaking everything using String. If you don't want to work with a list of characters then use a different thing, most likely Text. Honestly, if your only motivation is that beginners might get a wrong idea, I don't think anything along your questions is even worth considering. Usually it takes few minutes top to tell a newbie in #haskell that they probably want Text or whatever, if they even care. Trying very hard to change what we already have and still make it as accessible as it is today is simply something I can't justify in any way I try.
Thanks! I would welcome any references or links that my cursory googling has failed to find.
-- Andrew
-- Mateusz K.