I am porting this package to Java and have gotten stuck trying to get around the lazy/eager dissonance between the two languages. I didn't think it was going to be as severe as it is because the implementation depends entirely on function types, but I guess I was wrong. How do I preserve enough laziness for this to work? Alternatively, how do I minimally rewrite this so that it becomes eager enough for Java?
The Code
Available directly on pastebin now, thanks for telling me.
The Problem
I get a stack overflow (heh) on almost every "functional-style" method, and force()
has to be called almost constantly in order to prevent them even when not coding functionally.