title: How to define an enum with specific numeric values in Scala
body: <p>How can I define an enum with specific numeric values in Scala and be able to get the value list from the type?</p>
  
  <p>If I define the enum using the <code>Enumeration</code> type as follows:</p>
  
  <pre><code>object MyEnum extends Enumeration {
  
    type MyEnum = Value
  
    val A: Byte = -10
  
    val B: Byte = 0
  
    val C: Byte = 10
  }
  </code></pre>
  
  <p>and try to get the values as follows:</p>
  
  <pre><code>val byteValues = MyEnum.values.toList.map(_.id.toByte)
  </code></pre>
  
  <p>then I get an empty sequence.</p>