-
-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
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?
Metadata
Metadata
Assignees
Labels
No labels