Most languages, dynamically or statically typed, support "a" + "b" without it causing any issues, and that's very natural code. "a" + 7 is a potential problem, and it's usually disallowed.
Haskell's problem here is that it doesn't want String to be a primitive type, it's just [Char]. This is generally a poor design, and most language rightfully treat String as a basic type, not a list or array of anything.
Anyway, I tried to get Haskell to support this by defining some new type classes, with String being an instance, but Haskell doesn't want composite type like [Char] to be an instance, even with various language extensions enabled.
I'm not sure if there's any way to force this. I managed to do this for Scala type classes (Episode 57), but not for Haskell. Maybe someone else has better luck with this.
Yep, and mopst people use Text instead
My point on + to concatenate strings was not that it's unpopular, just that restricting it to numbers is a reasonable design choice
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Most languages, dynamically or statically typed, support "a" + "b" without it causing any issues, and that's very natural code. "a" + 7 is a potential problem, and it's usually disallowed.
Haskell's problem here is that it doesn't want String to be a primitive type, it's just [Char]. This is generally a poor design, and most language rightfully treat String as a basic type, not a list or array of anything.
Anyway, I tried to get Haskell to support this by defining some new type classes, with String being an instance, but Haskell doesn't want composite type like [Char] to be an instance, even with various language extensions enabled.
I'm not sure if there's any way to force this. I managed to do this for Scala type classes (Episode 57), but not for Haskell. Maybe someone else has better luck with this.
Yep, and mopst people use Text instead
My point on + to concatenate strings was not that it's unpopular, just that restricting it to numbers is a reasonable design choice