blob: 0e5c0ffc06ffa15711a924cbd84fc58dc65a782e (
plain) (
tree)
|
|
trait A {
type T
}
object O {
implicit def b(implicit x: A): x.T = error("")
}
class Test {
import O._
implicit val a: A = new A {}
implicitly[a.T] // works
implicitly[a.T](b(a)) // works
}
class ImplicitVsTypeAliasTezt {
class Monad[m[_]] {
type For[a] = _For[m, a]
implicit def toFor[a](m: m[a]): For[a] = throw new Error("todo") // lookup fails
// implicit def toFor[a](m: m[a]): _For[m, a] = throw new Error("todo") // fine.
}
trait _For[m[_], a] {
def map[b](p: a => b): m[b]
}
def useMonad[m[_], a](m: m[a])(implicit i: Monad[m]) = {
import i._
// value map is not a member of type parameter m[a]
for {
x <- m
} yield x.toString
}
}
|