The need for a formally verifiable mainstream programming language (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
But on the subject, laziness plays a considerable role in equational reasoning. Equational reasoning is simplified by it. For instance, these two expressions are equivalent in Haskell, but are not equivalent in a strict language.
Hence you can apply the rule that "let x = <expr> in <e2>" is equivalent to <e2> with x inlined, other than that the computation is only done once.Or if "f" is a function that is equivalent to "const 1", then "f (1 `div` 0)" should simplify to 1, not to bottom.
It also lets you write this kind of code (taken from Rosetta Code):
In this case, not having to prove totality makes the rest of the code easier. I deliberately chose this example and not the classic 3-line version with trial division because it's not inefficient and yet it still uses laziness to make the program simpler.And historically the reason why laziness was favored was because it enabled modularity better.
That is partly why I think laziness is worth having.
A Haskell without laziness would basically be a programming language from a different tradition. It has never been a "correctness at all costs" programming language, as I already stated in my previous comment. It may be that such a programming language is what those who design it want, but that isn't what it is.