Re:Total Functional Programming [pdf]
by ktRolster on Wednesday October 05, 2016 @05:34PM
(#12648106)
The main difficulty is that, very often, I do want my programs to loop forever/indefinitely. (Or at least until someone shuts them down).
[ Parent
| on HN ]
Right! That's the point of codata. If you want your program to run forever, you could express e.g. I/O events as an infinite (codata) stream. Then, instead of trying to prove that your program terminates (which it might not), it proves that your program "does something useful" every time it gets an IO event, for a particular practical definition of "doing something useful".
Re:Total Functional Programming [pdf]
by skybrian on Wednesday October 05, 2016 @11:06PM
(#12649930)
Sure, for the main loop. But you probably don't want any function called from the main loop to run forever. (In JavaScript, any single event handler should terminate quickly or it becomes unresponsive.)
Re:Total Functional Programming [pdf]
by SomeStupidPoint on Wednesday October 05, 2016 @07:21PM
(#12648829)
Would it significantly harm your experience if all your programs turned off after 1000 years of execution without input?
If not, your program could be "total" in most of the useful senses, and subparts could have tighter bounds, without any harm.