4 ms·
Yes, the next Haskell will be strict; that's generally although not universally accepted. I have however noticed that while much Haskell code doesn't make very
by Athas 4y ago
Yes, the next Haskell will be strict; that's generally although not universally accepted.
I have however noticed that while much Haskell code doesn't make very fancy use of laziness, it is widely used for very local control flow. E.g. a pattern I see relatively often is `fromMaybe (error "...some message")`, which would be problematic in a strict language (because `error` would always be evaluated).
Even without partial functions, laziness can also simplify code structure when you can just 'let' bind any value that will possibly be used on any control flow path, without worrying about unnecessary computation.
These conveniences are not deal-breakers - I get by without them just fine in SML - but they do serve to make the language a bit nicer.
- runevault 4y agoPerhaps there could exist a middle ground for cases where it does not risk significant "random" memory bloat and similar issues. I 100% think there are edge cases where laziness has value. Although in your fromMaybe case couldn't you just have it generate short circuiting code under the hood instead of always evaluating? That isn't necessarily quite the same thing as laziness.
- mibsl 4y agoShort circuiting is a special case of laziness. It's local only, so no thunks are required. The beauty of functions like fromMaybe is they're only that - just plain, regular functions. No special casing under the hood required.
- massysett 4y ago> Yes, the next Haskell will be strict; that's generally although not universally accepted. The essence of Haskell is non-strictness. It is the very reason Haskell was created. There are already strict functional languages, like OCaml. What value comes from stripping Haskell of the soul of its existence?