|
|
|
|
|
by trealira
6 days ago
|
|
Laziness is fundamental to Haskell: that's its raison d'ĂȘtre. If you look at old Haskell code and Haskell code from nowadays, I don't think formal verification (in the sense of automated theorem proving) was ever anyone's priority. In fact, old Haskell seems even more cowboy-like in the old days compared to how it is today. People were totally fine with leaving unhandled cases because their proof on paper demonstrated that those cases were unreachable, for instance. They often abused circular or infinite lists a lot more for the sake of a short, elegant implementation. To be honest, while Haskell shares syntax with some theorem provers, Haskell itself has a certain attitude that isn't really shared by any other programming language, an attitude which favors brevity and which gives freedom to the programmer, the opposite attitude to that of a theorem prover. Laziness is a big part of that. It allows the programmer to write seemingly mathematical code without actually having to prove it formally. |
|
Exploring laziness was one idea behind Haskell, one of many. And we learned a lot by doing it. But we also learned that the costs (in terms of execution, complier complexity, debugging, and even internal consistency in the language) are extremely high.
Laziness is not what lets you do equational reasoning in Haskell. The fact that you manage side effects, that's what lets you do equational reasoning. That is a feature of the type system, it has nothing to do with laziness.