-
-
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
filterM broken? #1054
Comments
@3rdLaw thanks for bringing this up. The We should probably do something to avoid confusion. @non it looks like you originally added |
Thanks for the clarification @ceedubs; I clearly assumed this was the same as Haskell/Scalaz's, so some documentation would be helpful. Does cats have an equivalent to |
@non to avoid confusion, what do you think about renaming our |
@non on second thought, can you think of any practical example of using the method as it currently exists in cats? |
Resolves typelevel#1054. This simply removes `MonadFilter.filterM` to prevent confusion due to this `filterM` being different than that from Haskell or Scalaz. This version of `filterM` doesn't seem particularly useful to me. The only type that comes to mind for which this might be useful is `Option`, and it's pretty easy to come up with a more straightforward implementation for the `Option` case. A more general solution for `filterM` is provided by typelevel#1148, but so far there doesn't seem to be any interest in that proposal, so I don't want it to hold up resolving
`TraverseFilter` is a port of Haskell's Data.Witherable, and represents structures that support doing a combined `traverse` and `filter` as a single operation. `FunctorFilter` is similar but is limited to a combined `map` and `filter` as a single operation. The main reason that I've added `FunctorFilter` is to extract the commonality between `TraverseFilter` and `MonadFilter` so that they don't have collisions in methods such as `filter`. Some benefits of these type classes: - They provide `filterM` (actually a more general version of it - `filterA`), which resolves typelevel#1054. - They provide `collect` which is a handy method that is often used on standard library collections but had been absent in Cats.
I ran the following in sbt console after a git pull:
Compare this to scalaz's results:
The text was updated successfully, but these errors were encountered: