-
-
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
ap
ordering is inconsistent
#2172
Comments
I agree this is inconsistent/confusing/unfortunate. There's some related discussion in #2074. |
Ah, I see there's some history here! If this is a duplicate of an existing thing, we can maybe close? I ran into this problem when trying to implement an applicative |
@bkirwi the one that I linked is closed, so I think that we should keep this one open. We used to have the function on the right and it caused lots of confusion because for a proper |
A nice incremental step might be to add the "ideal" signature as a new method / syntax extension, with the idea that we might switch in a future major release. My inclination would be to add to |
In
Apply
,ap
is defined like so:If we're using the generated typeclass syntax, that means user code looks like
function.ap(value)
.Unfortunately, when
ap
is explicitly defined, it's almost always defined the opposite way. For example, onValidated
:This gives us usage code like
value.ap(function)
. Knowing which ordering to expect is pretty confusing: it varies depending on the data type involved and whether or not we're working with it in a generic context.I guess since we're at 1.0 we probably can't just go and fix it, but we might be able to define an alias that's used more consistently. (
ap
has always felt like a bit of an odd name to me...cats
usually sticks to full words for methods like this.) i have some preference for the second form: it keeps the function on the right likemap
andflatMap
, and the type inference is better.The text was updated successfully, but these errors were encountered: