-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide instance of Alternative for Set in alleycats
This allows the use of methods from `Alternative` on a `Set` - for instance, I want to be able to use `separate` on a `Set`: ``` import cats.implicits._ import alleycats.std.set._ val stringsAndInts: Set[Either[String, Int]] = Set(Right(6),Left("Foo")) val (strings: Set[String], ints: Set[Int]) = stringsAndInts.separate ``` The `Alternative` typeclass just requires `MonoidK` (already provided for `Set` in `cats-core`) & `Applicative` (already provided for `Set` by `Monad` in `alleycats`, so adding it to `alleycats` is a small change. https://github.com/typelevel/cats/tree/main/alleycats-core#set_-instances
- Loading branch information
Showing
2 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters