3 ms·
This construct is totally possible in Haskell, one common way of achieving it is to store the 'done' boolean in a State monad. The really funny thing is that t
by chongli 3y ago
This construct is totally possible in Haskell, one common way of achieving it is to store the 'done' boolean in a State monad.
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.