4 ms·
I quite like the way Rust handles strings. Better than Haskell.
by vmchale 6y ago
I quite like the way Rust handles strings. Better than Haskell.
- nilkn 6y agoI think it's pretty bad in both languages. In Haskell it's trivial to understand the difference between a ByteString and Text. The names give it all away. You do need to know the difference between lazy and strict values, but that's universal to the language and not hard to understand. I'd say that strings in Haskell are more annoying than hard to understand. In Rust, even figuring out why some of the string types exist in the first place and what they mean is hard, and you still have the interconversion problem, which now is not only annoying but also difficult to understand.
- cryptonector 6y agoHaskell implementing strings as lists of characters is a problem. Basically, you can't use them for anything performant. A proper string library should be a Functor, naturally, but it should also be much more like a rope and much less like a list under the covers and in its API.
- nilkn 6y agoI agree, but that's why you use Text and ByteString. Annoying? Yes. Hard to understand? Not at all. Rust strings to me are both annoying and hard to understand and explain.