6 ms·
I wish this was the case, but it's not. A bad string type and lots of partial functions are legitimate red flags, not "first world problems".
by seagreen 10y ago
I wish this was the case, but it's not. A bad string type and lots of partial functions are legitimate red flags, not "first world problems".
- wyager 10y ago> A bad string type It's only bad in the sense that it's inefficient. It's preferable to most other string types in many ways. It's also totally reasonable to have in the prelude: [] is there, and Char is there, so really all they've done is slapped the two together. The current situation (importing ByteString or Text for performance) is pretty good IMO. Haskell doesn't have Map or Set or anything in the prelude, so I think it's reasonable to leave powerful packed text types out as well. In fact, I would even support leaving [] out of the prelude and making the import of Data.List explicit. > lots of partial functions are legitimate red flags This is true, but the fact that we're even complaining about this is a first-world problem. Other languages have partial behavior built in to the language. Try going to a python or java developer and telling them "array access should return an optional type instead of throwing an exception on out-of-bounds". This is totally reasonable to deal with in Haskell, but inconceivable in other languages.
- seagreen 10y agoThe current situation (importing ByteString or Text for performance) is pretty good IMO. Haskell doesn't have Map or Set or anything in the prelude, so I think it's reasonable to leave powerful packed text types out as well. Interesting. Maybe all we have is a community problem then? Since `String` is right there, and `Text` is both an additional dependency and an import away `String` gets used in situations it shouldn't. Try going to a python or java developer and telling them "array access should return an optional type instead of throwing an exception on out-of-bounds". Alright, I think we have synthesis. From a Python programmers perspective the Prelude issues are somewhat trivial. From a Haskell programmers perspective it's offensive to good engineering. So it depends on your perspective:)
- tome 10y ago> Maybe all we have is a community problem then? Since `String` is right there, and `Text` is both an additional dependency and an import away `String` gets used in situations it shouldn't. Yes, that's exactly what the problem is. String gets used instead of Text because it's the path of least resistance.
- wyager 10y agoAgreed on both points. It's unfortunate that people use String just because it's there, or Int when they should use Word (because Word wasn't added to the Prelude until recently). For example, it's awful that length returns an Int. It should return a Word or be generic. Indeed, the Haskell programmer is the one I'd say lives in "the first world".