Closed Randgalt closed 8 years ago
@Alex-At-Home here's the final implementation. I had to make some specific changes. With StreamFor filter() is required as once you start processing a stream you can't add more or you get an exception. So MonadicForImpl now has 2 methods for yielding depending on whether or not fitler() is available. Halva's original For now uses a generated StreamFor internally.
@Alex-At-Home have a look at https://github.com/Randgalt/halva/blob/9fa3179a3ff955fdfbe39592e1354b09c3ccb633/halva-test/src/test/java/com/company/FutureForFactory.java to see how the class generator works.
Nice! And the generated class is the same as before. That's awesome. What about the multi type case?
(ps Yeah I hadn't gotten around to testing filter, sorry about that!)
What about the multi type case?
I need to test that - I'll do that next.
@Alex-At-Home fyi - I tried it with your FP example Writer and it worked perfectly.
merged
Completely re-worked for-comp from work by Alex Piggott. For-comps can now be generated for things other than streams