r/functionalprogramming • u/metazip • Jun 28 '24
Question Does Lazy Evaluation have a Future?
In Haskell it is used for deforestation to keep the stack low. But after some experience with it, it is simply a problematic concept.
UPDATE: What do you think about a concept with buds?
Buds that change from unbound to bound via a side effect,
which can be checked beforehand with isbound. Wouldn't a concept with buds be much more flexible.
2
Upvotes
View all comments
Show parent comment
2
u/faiface Jun 29 '24
We don’t need everything or nothing when it comes to termination. Preventing various things one by one is also a benefit. Even without any totality checking, making lists strict and finite will move the hang up to the construction of the list instead of whatever place the list is consumed. Also it helps with thinking about the program. You instatly see what’s a list and what’s a stream, so you know what you can with them. In Haskell, you can easily make the mistake of thinking a list is finite, when it actually isn’t or think a function accepts an infinite list when it doesn’t, or not in all cases.