How to look up the type of a method returning a type parameter with scala reflection?
<pre><code>trait F[S]{
  def evaluate(): S
}
</code></pre>

<p>From typeOf[F[Double]] how can find that the return type of "evaluate" is Double?</p>

<pre><code>typeOf[F[Double]]
 .decls
 .filter(_.name.toString=="evaluate")
 .head
 .asMethod
 .returnType
 .dealias
</code></pre>

<p>==> S</p>

<p>The type information that evaluate returns a double hasn't been erased -- it just seems like its hard to look up and match up with the type parameters:</p>

<pre><code>typeOf[F[Double]].typeArgs 
</code></pre>

<p>==> List(Double)</p>

<p>Its possible that my classes may have many type parameters, so I can't be sure that S is the first type parameter, but the types of the type parameters seem to be known.</p>