purescript-lazy icon indicating copy to clipboard operation
purescript-lazy copied to clipboard

Guard against double force with an exception?

Open natefaubion opened this issue 2 years ago • 1 comments

If you use Lazy recursively, and make it too strict, you can wind up calling force inside of a force. Currently, this will loop forever (or blow the stack more likely), but should we guard against this and throw an exception? The compiler does this with recursive binding groups (which can appear anywhere), so this isn't really adding exceptions where there otherwise wouldn't be any.

natefaubion avatar Jul 14 '23 19:07 natefaubion

Throwing sounds good to me - an infinite loop is no better than an error, and at least throwing will slightly demystify what the actual problem is.

garyb avatar Jul 15 '23 13:07 garyb