scala-library-next
scala-library-next copied to clipboard
WIP: Future and try tap each
Addresses #44
As originally discussed in scala/scala#8857 :
- Defines
tapEachforTry - Defines
tapEachforFutures, using transform, leveraging the existing implementation forTry
Following the pattern that was laid in the previous PRs. Marking WIP because of the following mainly:
-
Because Try is an abstract class, the pattern looks slightly different. I haven't been able to find an elegant method to define an extension method for each instance AND the abstract class, and still have things dispatch properly. I went with pattern matching to dispatch things here but it means that this extension method will need to be broken into 3 pieces, should this be ever merged into stdlib
-
I open to suggestions for testing Futures (or testing this in general since we are testing side effects).
Junitdoesn't seem to be very fond of awaiting. I am looking at the Future Test in the Scala Repo and that seems to be very basic and isn't asserting any values.
Appreciate any feedback.