Alright. I’m sorry for taking such a long time to write another message, but I feel like I had to absorb everything that everyone is saying. I’m extremely thankful for all the interactions and I feel like I need to point out a couple of notes after what people are saying:
First off, perhaps in the long run it is more user friendly to eradicate Text
rather than String
. Throughout everything mentioned thus far it feels like what people are imagining if in a hypothetical world we have all carried this herculean task, all code would be littered with Text
instead of String
. I think that this wouldn’t be a good experience for beginners, as they are called String
right about everywhere else. Of course, I don’t mean that we should just remove Text
and it’s semantics, but more like keep String
's name and replace its internals with Text
…? This sounds kind of tough, but maybe it’s easier than I think?
The issues that come with doing something like that, as people mentioned, comes in a lot of forms:
Firstly… one of the things at the heart of the problem is that, as someone previously mentioned, a String
is ultimately just a [Char]
, and this is perhaps easier to abstract over than a monomorphic Text
?
I’m not quite sure about how one would solve this… I think it would be best if, outwardly, String
still acted similarly to [Char]
, but it would actually be invalid to say type String = [Char]
, as the internals would be closer to Text
. I am really quite unsure about this, as I am not very sure about the internals and all I can comment about is that it would be more convenient if we picked Text
over the current String
and somehow replaced String
with it while attempting to make it still act like String
but with the benefit of Text
? To me, this sounds like the premise of a really bad piece of fiction, but maybe people can think of things up to make it a reality… In case people complain about the special casing part and not the outrageous piece of fiction that I’ve written, I think it’s totally fair to do some fairly special things when it comes to String
. I think, if nothing else, it would make things considerably more convenient that a string type can get some use out of the typeclasses like Foldable
and the others. Perhaps we can create some sort of StringContainer
type that could be used if nothing else, if we don’t want to rely on Char
for anything… though, maybe it could be made to work with Text
?
I think this will help with what @tomjaguarpaw previously mentioned, about being unable to stop people putting Char
s inside []
. I think that all we have to do is lie and make it so that [Char]
is really an alias to the new String
, or something similar?
I think this will also help with pattern matching, as it would now be simpler?
I’m really sorry if this all sounds really idiotic, but it sounds like the best case scenario, so I’m interested in what we would need to sacrifice to reach this…
Secondly… as previously mentioned, there’s the issue of whether we should pick lazy or strict variants of Text
. There also has been recommendations to have Text
be strict and use [Text]
for laziness, I believe.
I’m not really too picky about this part, as I think it would be frankly equivalent in either situation… though, I suppose it would perhaps be better to go with the lazy text variant; I don’t see much benefit in having strict text be the default, and I feel like a “default” Textnot breaking expectation from the demand of
String` would be without much fault. As I said though, I don’t really have any strong feelings here.
Once again, I’m really sorry if this is sounding outrageous…