Skip to content
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

Can't use eq if order is also imported #811

Closed
joprice opened this issue Jan 16, 2016 · 9 comments
Closed

Can't use eq if order is also imported #811

joprice opened this issue Jan 16, 2016 · 9 comments

Comments

@joprice
Copy link

joprice commented Jan 16, 2016

Is this expected?

import cats._
import cats.std.all._
import cats.syntax.eq._
import cats.syntax.order._

class Test {
  1 === 2
}

// [error] ... value === is not a member of Int
// [error]   1 === 2
@joprice joprice changed the title Can't use equality if order is also imported Can't use eq if order is also imported Jan 16, 2016
@joprice
Copy link
Author

joprice commented Jan 16, 2016

Ok this makes sense, since OrderSyntax extends PartialOrderSyntax extends EqSyntax.

Is there a library-level trick to avoid this ambiguity? Moving the order import into another enclosing scope, such as within the Test class, raises it's priority, so that's a usercode-level workaround..

@ceedubs
Copy link
Contributor

ceedubs commented May 14, 2016

I don't know of any way that we can work around this within cats, but I think that we should be sure to address the conflicting import problem in any import guide that may be created as part of #1026.

@diesalbla
Copy link
Contributor

diesalbla commented Apr 13, 2019

@kailuowang It has been three years since this issue was opened. Looking at it for a minute, I can see only two ways forward:

One way is to modify the traits OrderSyntax and PartialOrderSyntax, so that they no longer inherit from EqSyntax or each other. Each one would only provide the specific methods and operators introduced by their respective type-class, and not those from the other ones. This is similar to how import cats.syntax.applicative._ does not bring .map or .void, and one has to use cats.syntax.functor._. This way would be both binary and source-breaking.

The other way is to leave the cats code as is, and close this issue.

@kailuowang
Copy link
Contributor

The fix requires breaking changes. I would vote for closing this issue. @LukaJCB what do you think?

@tpolecat
Copy link
Member

Agree re: closing

@diesalbla
Copy link
Contributor

diesalbla commented Apr 13, 2019

Pertinent but not main topic: Are there any plans for a cats 2.0 release, at some point, one in which breaking changes such as this one could be added?

@kailuowang
Copy link
Contributor

The roadmap for 2019 is here https://github.com/typelevel/cats/blob/master/ROADMAP_2019.md
For breaking changes like the fix you suggested we'll have to wait for 3.0, which is likely to be post 2020. It's not ideal to have inconsistencies, but we have to evaluate the benefit of fixing it against the cost of the breaking change for users.

@kailuowang
Copy link
Contributor

sorry accidentally closed it, I meant to wait on hearing luka.

@kailuowang kailuowang reopened this Apr 14, 2019
@LukaJCB
Copy link
Member

LukaJCB commented Apr 15, 2019

I also agree to closing this issue, we can discuss refinement of the roadmap in the appropriate issue :)

@LukaJCB LukaJCB closed this as completed Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants