title: Why does mapping over a Scala enumeration's ValueSet not change the type of the values?
body: <p>I found some puzzling behavior in Scala's ValueSet. With an enum like this,</p>
  
  <pre><code>object MyEnum extends Enumeration{
      val V1 = new MyEnum
      val V2 = new MyEnum
      class MyEnum extends Val
      implicit def convertValue(v: Value): MyEnum = v.asInstanceOf[MyEnum]
  }
  </code></pre>
  
  <p>Mapping <code>MyEnum.values</code> from Value to MyEnum produces another ValueSet, which when converted to an array does not retain the mapped type.</p>
  
  <pre><code>val naiveMappedValues = MyEnum.values.map(
      implicitly[MyEnum.Value =&gt; MyEnum.MyEnum]).toArray
  // REPL prints: naiveMappedValues: Array[MyEnum.Value] = Array(V1, V2)
  </code></pre>
  
  <p>If <code>MyEnum.values</code> is first converted to a list, then the type of the final array is correct.</p>
  
  <pre><code>val mappedValues = MyEnum.values.toList.map(
      implicitly[MyEnum.Value =&gt; MyEnum.MyEnum]).toArray
  // REPL prints: mappedValues: Array[MyEnum.MyEnum] = Array(V1, V2)
  </code></pre>
  
  <p>Why does this happen? Why is it necessary to first convert the ValueSet to a List before mapping the values?</p>