droste icon indicating copy to clipboard operation
droste copied to clipboard

Ambiguous implicits when using project syntax

Open Voltir opened this issue 6 years ago • 1 comments

In trying to upgrade from 0.6 to 0.7, I was using _.project in various places to unwrap a single level of a pattern functor - that now fails with errors like:

[error]  found   : x$3.type (with underlying type datum.patterns.data.Data)
[error]  required: ?{def project: ?}
[error] Note that implicit conversions are not applicable because they are ambiguous:
[error]  both method toProjectSyntaxOps in trait ProjectSyntax of type [F[_], T](t: T)(implicit PFT: higherkindness.droste.Project[F,T])higherkindness.droste.syntax.ProjectSyntax.ProjectOps[F,T]
[error]  and method toFoldableProjectSyntaxOps in trait ProjectSyntax of type [F[_], T](t: T)(implicit PFT: higherkindness.droste.Project[F,T], implicit FF: cats.Foldable[F])higherkindness.droste.syntax.ProjectSyntax.ProjectFoldableOps[F,T]
[error]  are possible conversion functions from x$3.type to ?{def project: ?}

Looking at the trait ProjectSyntax, perhaps it could be resolved using the LowPriorityImplicitTrait trick to make one of the implicit take precedence over the other?

Voltir avatar Jun 25 '19 18:06 Voltir

Can confirm this on 0.8.0.

justjoheinz avatar Oct 28 '20 09:10 justjoheinz