Closed gdiet closed 3 years ago
@NthPortal Sorry, I overlooked in the README that changes/additions to existing library classes should be coded as extension methods.
I will open a new PR with the specialized extension method, replacing this PR - I think it's cleaner that way...
If I provide a specialized tapEach extension for Option, will this stay an extension in Scala 3.1 (which I wouldn't like too much) or will the specialized extension method be "merged" into scala.Option directly eventually? If the latter, would it be a good idea to add a comment how this could be done?
to be honest, I'm suspicious the conversion to Seq
in Option
will have a higher priority than any extension method we add in this library, making this change impossible until 3.T, but you'd have to test to find out
Superseded by PR https://github.com/scala/scala-library-next/pull/80
Add specialised version of
tapEach
toscala.Option
to preserve the type.The actual addition is in the second commit https://github.com/scala/scala-library-next/commit/fb1f19a796387fb45c7a4022d527c1a26e86a8e3.
See also https://stackoverflow.com/questions/67017901/why-does-scala-option-tapeach-return-iterable-not-option?noredirect=1#comment118462412_67017901