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

Type missmatch errors #172

Open
kaffepanna opened this issue Jan 7, 2020 · 0 comments
Open

Type missmatch errors #172

kaffepanna opened this issue Jan 7, 2020 · 0 comments

Comments

@kaffepanna
Copy link

After playing around a bit with simulacrum i have seen a few weird (maybe) behaviours

@typeclass trait TestClass[S[_]] {
  def test[P[_], I](a1: S[P[I]]): I
}

Works.

Adding second argument to test

@typeclass trait TestClass2[S[_]] {
 def test[P[_], I](a1: S[P[I]], x: I): I
}

results in:

type mismatch;
found   : S[P[I]]
required: S[P[Any]]
@typeclass trait TestClass2[S[_]] {

Going back to the first example. Lets add a Constraint on P[_]

  @typeclass trait TestClass3[S[_]] {
    def test[P[_]: Foldable, I](a1: S[P[I]]): I
  }

also works. So lets add a constraint on I

  @typeclass trait TestClass4[S[_]] {
    def test[P[_]: Foldable, I: Eq](a1: S[P[I]]): I
  }

results in:

 found   : cats.Eq[A]
    (which expands to)  cats.kernel.Eq[A]
 required: cats.Eq[I]
    (which expands to)  cats.kernel.Eq[I]
  @typeclass trait TestClass4[S[_]] {

Is this the desired behaviour?

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

1 participant