title: haxe: How to use enum values of concrete enum type in generic class?
body: <p>I'd like to make generic class that works with passed enum type, like this:</p>
  
  <pre><code>class Holder&lt;E, T&gt; { // I suppose to pass only enum types as E, how to limit them?
  
      function new() {
          mMap = new Map&lt;EnumValue, T&gt;();
      }
  
      function add(aKey:EnumValue, aValue:T) { // aKey is practically ANY enum value
          mMap.set(aKey, aValue);
      }
  
      var mMap:Map&lt;EnumValue, T&gt;; // what type should I use as key? like E&lt;EnumValue&gt;
  
  }
  
  enum Keys {
      A;
      B;
  }
  
  enum Injection {
      NOT_ALLOWED;
  }
  
  // first drawback
  var holder = new Holder&lt;Keys, String&gt;();
  holder.add(Keys.A, "This is A");
  holder.add(Keys.B, "This is B");
  holder.add(Injection.NOT_ALLOWED, "Not allowed by design!"); // it must not be allowed
  
  // second drawback
  var strange = new Holder&lt;String, String&gt;(); // it must not be allowed too
  </code></pre>
  
  <p>I never use E type in class declaration because I don't understand how to propagate enum value back to it's type. And I can't just write <code>Holder&lt;Enum&lt;E&gt;,T&gt;</code> in class definition to use <code>E</code> type for enum values.
  What should I do to limit <code>E</code> just as enum types and then get arguments only of this type?</p>