|
|
|
|
|
by pipo234
1081 days ago
|
|
To some extent for while loops are a matter of taste. But the issue is that unless you have mutable variables, you cannot use typical imperative control variables. So something like: bool done = false;
while (!done) {
...
}
makes no sense unless you have some way of setting `done = true`; which is not possible in purely functional languages like Haskell. |
|
The really funny thing is that the while loop itself is not built-in to Haskell but you can write it yourself as a function. In other languages (non-lazy) this sort of thing is not possible without resorting to macros or other tricks, because laziness is required in order to define the correct semantics for conditionals.