Last active
January 2, 2016 11:09
-
-
Save markhibberd/8294295 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
object blah { | |
case class Id[+A](a: A) | |
object Id { | |
implicit def IdFunctor: Functor[Id] = ??? | |
} | |
case class OptionT[F[+_], +A](x: F[Option[A]]) | |
trait Functor[F[+_]] | |
object OptionT { | |
implicit def OptionTFunctor[F[+_]: Functor]: Functor[({ type l[+a] = OptionT[F, a] })#l] = | |
sys.error("todo") | |
} | |
case class Writer[+W, +A](w: W, a: A) | |
object Writer { | |
implicit def WriterFunctor[W]: Functor[({ type l[+a] = Writer[W, a] })#l] = | |
sys.error("todo") | |
} | |
type WWW[+A] = Writer[String, A] | |
type OOO[+A] = OptionT[WWW, A] | |
implicitly[Functor[WWW]] | |
implicitly[Functor[OOO]] | |
implicitly[Functor[({ type l[+a] = Writer[String, a] })#l]] | |
implicitly[Functor[({ type l[+a] = OptionT[ ({ type m[+b] = OptionT[Id, b] })#m, a] })#l]] | |
implicitly[Functor[({ type l[+a] = OptionT[ ({ type m[+b] = Writer[String, b] })#m, a] })#l]] | |
// implicitly[Functor[({ type l[+a] = OptionT[WWW, a] })#l]] | |
/* | |
blah.scala:19: error: could not find implicit value for parameter e: blah.Functor[[+a]blah.OptionT[[+A]blah.Writer[java.lang.String,A],a]] | |
implicitly[Functor[({ type l[+a] = OptionT[WWW, a] })#l]] | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment