5 ms·
Not completely. non-nullable by default is nice, ignoring possible nulls is nice, but Haskell's Maybe still suffers from premature generality by conflating all
by bcoates 11y ago
Not completely. non-nullable by default is nice, ignoring possible nulls is nice, but Haskell's Maybe still suffers from premature generality by conflating all forms of absence. A 'Maybe T' is fundamentally, context-sensitively, not equivalent to any other 'Maybe T' in the same way all 'T's are. This is bad.
edit: carsongross beat me to what I'm talking about with a better explanation: https://news.ycombinator.com/item?id=10149129 https://news.ycombinator.com/item?id=10149129
- dragonwriter 11y agoWhen you need to distinguish missing values, that's why Haskell has Either. Maybe is for when you only care if there is a good result are not, Either covers the case when you need to distinguish different kinds of "not".
- lmartel 11y agoCan't you just handle this with something like `Either ErrCode T`? (And if not, please do explain why!)
- bcoates 11y agoYou can, but the existence (and use in libraries!) of Maybe is still bad for the same reason having 'null' is bad. It's an anti-feature that would enrich the language by not existing.