-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate ifA. #3893
Deprecate ifA. #3893
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this. I like the Selective version, but we need to finish Selective.
This is failing because of some problems in
|
Were those problems fixed? I see main is passing. Do we just need a merge/rebase? |
The ifA method has been discussed as dangerous and misleading, because executing the effects of _both_ branches is hardly ever desirable. Proposed in Issue #3889 Instead, users of this method should use either the `ifM` method of the `FlatMap` class (when each branch is an effect) or the `ifF` method of the `Functor` class (where each branch is a value).
Ammended, rebased, and pushed. Sadly, reviews are lost. Could you look again? |
@deprecated("Dangerous method, use ifM (a flatMap) or ifF (a map) instead", "2.6.2") | ||
def ifA[A](fcond: F[Boolean])(ifTrue: F[A], ifFalse: F[A]): F[A] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also eventually make this package private, shutting off the source access without breaking bincompat. We should wait a while though.
So, a year and a half ago, somebody thought that having an
ifA
method, an applicative counterpart of theifM
method fromFlatMap
(or M for Monad), would be a good idea. Turns out, having an "If-then-else" that actually performs both effects is hardly ever desirable, but the name naturally suggests it would not, so that was quite misleading. This has tripped some people. Thus the time has come to deprecate it, and retire it soon.Resolves #3889