-
Notifications
You must be signed in to change notification settings - Fork 254
Implement Predicate combinators #98 #102
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
Conversation
@mperry can you please have a look? please provide feedback. |
On my list of todos. |
:) thanks |
public static <A, B> F<B, Boolean> contramap(F<B, A> f, F<A, Boolean> p){ | ||
return compose(p, f); | ||
} | ||
|
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.
Isn't this mapping over a function, rather than a contramap? E.g. F1W.lift(...).map(....)
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.
technically it's a contramap
, because it's applying function to input of F<A, Bool>
(negative position)
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 see now, it is contramapping over the predicate, whereas I was thinking it was mapping over the first function. It looks like these two cases are equivalent here, but given we are focused on predicates contramap is appropriate for the name.
In summary, need to resolve |
@mperry thanks, you will see changes in a branch henceforth. |
I think the names are fine as is. Specifically, I think Here are some considerations:
In some older Haskell libraries, with use of contravariant functors, the name Unlike for invariant (exponential) mapping, where I have seen several different names, for the same type of mapping; |
Data.Function.Predicate (http://hackage.haskell.org/package/predicates-0.1/docs/Data-Function-Predicate.html) uses |
Hi @amarpotghan, why did you close this PR? |
No description provided.