title: No ClassTag available for A - but implicit parameter present
body: <p>Using scala 2.12.4 I cannot get this code to work since it says</p>
  <blockquote>
  <p>[error] .../src/main/scala/effect.scala:32:11: No ClassTag available for A</p>
  <p>[error]     Effect(effectDefinition)</p>
  <p>[error]           ^</p>
  <p>[error] one error found</p>
  <p>[error] (compile:compileIncremental) Compilation failed</p>
  </blockquote>
  <p>here is the (simplified) code. the reason i need the class tag is to do a filtering later in the code (installEffect).</p>
  <pre><code>import scala.reflect.ClassTag
  
  package object effect {
  
    type EffectDefinition[A &lt;: EffectBearing[A]] = A =&gt; Unit
  
    case class Effect[A &lt;: EffectBearing[A]](fx: A =&gt; Unit)(implicit tag: ClassTag[A]) {
      def effectedType: Class[A] = tag.runtimeClass.asInstanceOf
    }
  
    trait EffectBearing[This &lt;: EffectBearing[This]] {
      def installEffect(effect: Effect[This]): Unit = {
        effect.fx(this.asInstanceOf[This])
      }
    }
  
    trait EffectPropagating {
  
      def installEffect[T&lt;: EffectBearing[T]](effect: Effect[T], typ: Class[T]): Unit =
        find(typ).foreach(_.installEffect(effect))
  
      protected def find[T &lt;: EffectBearing[T]](typ: Class[T]): Set[T]
    }
  
    class Foo extends EffectBearing[Foo] {}
  
    val fxFoo: EffectDefinition[Foo] = print(_)
  
    def translate[A &lt;: EffectBearing[A]](effectDefinition: EffectDefinition[A]): Effect[A] =
      Effect(effectDefinition)
  
    val fx = translate(fxFoo)
  
  }
  </code></pre>
  <p>ps: is the usage of</p>
  <pre><code>tag.runtimeClass.asInstanceOf
  </code></pre>
  <p>very bad? I couldn't get around that cast</p>