Skip to content

Instantly share code, notes, and snippets.

@eamelink
Created March 23, 2016 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eamelink/a70df85535eee3ab56dd to your computer and use it in GitHub Desktop.
Save eamelink/a70df85535eee3ab56dd to your computer and use it in GitHub Desktop.
import cats.data.Coproduct
import cats.free.Inject
object CoproductInject {
trait A[T]
trait B[T]
trait C[T]
type Two[T] = Coproduct[A, B, T]
val IA = implicitly[Inject[A, Two]] // Works
val IB = implicitly[Inject[B, Two]] // Works
type Three[T] = Coproduct[Two, C, T]
val IAT = implicitly[Inject[A, Three]] // Doesn't work
val IBT = implicitly[Inject[B, Three]] // Doesn't work
val ICT = implicitly[Inject[C, Three]] // Works
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment