-
-
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
Removed Ops and replaced them with forwarders. #2766
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
355979e
Removed Ops and replaced them with forwarders.
drdozer 60c2fe6
Merge branch 'master' into no-macros
kailuowang 2d4cc2c
Updated FunctionK.lift as per https://github.com/typelevel/cats/issue…
drdozer 4a98735
Merged in conflicting changes to FunctionK
drdozer f0e8cf3
Fixed commit conflict.
drdozer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
package cats | ||
package syntax | ||
|
||
import cats.macros.Ops | ||
|
||
trait GroupSyntax extends SemigroupSyntax { | ||
// TODO: use simulacrum instances eventually | ||
implicit final def catsSyntaxGroup[A: Group](a: A): GroupOps[A] = | ||
new GroupOps[A](a) | ||
} | ||
|
||
final class GroupOps[A: Group](lhs: A) { | ||
def |-|(rhs: A): A = macro Ops.binop[A, A] | ||
def remove(rhs: A): A = macro Ops.binop[A, A] | ||
def inverse(): A = macro Ops.unop[A] | ||
def |-|(rhs: A): A = implicitly[Group[A]].remove(lhs, rhs) | ||
def remove(rhs: A): A = implicitly[Group[A]].remove(lhs, rhs) | ||
def inverse(): A = implicitly[Group[A]].inverse(lhs) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
package cats | ||
package syntax | ||
|
||
import cats.macros.Ops | ||
|
||
trait PartialOrderSyntax extends EqSyntax { | ||
implicit final def catsSyntaxPartialOrder[A: PartialOrder](a: A): PartialOrderOps[A] = | ||
new PartialOrderOps[A](a) | ||
} | ||
|
||
final class PartialOrderOps[A](lhs: A)(implicit A: PartialOrder[A]) { | ||
def >(rhs: A): Boolean = macro Ops.binop[A, Boolean] | ||
def >=(rhs: A): Boolean = macro Ops.binop[A, Boolean] | ||
def <(rhs: A): Boolean = macro Ops.binop[A, Boolean] | ||
def <=(rhs: A): Boolean = macro Ops.binop[A, Boolean] | ||
def >(rhs: A): Boolean = A.gt(lhs, rhs) | ||
def >=(rhs: A): Boolean = A.gteqv(lhs, rhs) | ||
def <(rhs: A): Boolean = A.lt(lhs, rhs) | ||
def <=(rhs: A): Boolean = A.lteqv(lhs, rhs) | ||
|
||
def partialCompare(rhs: A): Double = macro Ops.binop[A, Double] | ||
def tryCompare(rhs: A): Option[Int] = macro Ops.binop[A, Option[Int]] | ||
def pmin(rhs: A): Option[A] = macro Ops.binop[A, Option[A]] | ||
def pmax(rhs: A): Option[A] = macro Ops.binop[A, Option[A]] | ||
def partialCompare(rhs: A): Double = A.partialCompare(lhs, rhs) | ||
def tryCompare(rhs: A): Option[Int] = A.tryCompare(lhs, rhs) | ||
def pmin(rhs: A): Option[A] = A.pmin(lhs, rhs) | ||
def pmax(rhs: A): Option[A] = A.pmax(lhs, rhs) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
package cats | ||
package syntax | ||
|
||
import cats.macros.Ops | ||
|
||
trait SemigroupSyntax { | ||
// TODO: use simulacrum instances eventually | ||
implicit final def catsSyntaxSemigroup[A: Semigroup](a: A): SemigroupOps[A] = | ||
new SemigroupOps[A](a) | ||
} | ||
|
||
final class SemigroupOps[A: Semigroup](lhs: A) { | ||
def |+|(rhs: A): A = macro Ops.binop[A, A] | ||
def combine(rhs: A): A = macro Ops.binop[A, A] | ||
def combineN(rhs: Int): A = macro Ops.binop[A, A] | ||
def |+|(rhs: A): A = implicitly[Semigroup[A]].combine(lhs, rhs) | ||
def combine(rhs: A): A = implicitly[Semigroup[A]].combine(lhs, rhs) | ||
def combineN(rhs: Int): A = implicitly[Semigroup[A]].combineN(lhs, rhs) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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't simply remove this code. we need to create two versions of it, one for scala 2.x with the current implementation and another with the new scala3 implementation. Like in this example
https://github.com/typelevel/cats/tree/master/core/src/main/scala-2.13%2B/cats/compat
we created two versions of
cats.compat.SortedSet