Created
September 9, 2016 20:08
-
-
Save kailuowang/2e7a82cd8752d3ca55893b38a79fbd1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.{Applicative, Unapply} | |
import cats.instances.all._ | |
import shapeless._ | |
object Test { | |
trait Foo[L <: HList] | |
object Foo extends MkFoo | |
trait MkFoo0 { | |
implicit def con[H, T <: HList](implicit st: Foo[T]): Foo[H :: T] = ??? | |
} | |
trait MkFoo extends MkFoo0 { | |
implicit def nil[F[_] : Applicative]: Foo[HNil] = ??? | |
implicit def single[H](implicit un: Unapply[Applicative, H]): Foo[H :: HNil] = ??? | |
} | |
implicitly[Foo[Either[String, Int] :: Either[String, Int] :: Either[String, Int] :: HNil]] // <- attempt1 passes | |
implicitly[Foo[Either[String, Int] :: HNil]] //<- attempt 2 fails compilation with diverging implicit expansion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment