title: Java 8 Generic of Generic for Monad Transformer
body: <p>I'm using "totally lazy" and I have a desire for <code>Either&lt;String,Option&lt;A&gt;&gt;</code> in a program I'm writing.  This is a terrific place to use a Monad Transformer for Option (similar to the awesome one that exists in Scalaz 7).  I can't seem to get the Generics right in Java 8.  The code below is what I would love for it to look like (for a start).  Any suggestions of how to get it to work/compile would be AMAZING!!!  Please help me get this Monad Transformer to exist for my Java 8 code.  </p>
  
  <pre><code>import com.googlecode.totallylazy.Monad;
  import com.googlecode.totallylazy.Option;
  import com.googlecode.totallylazy.functions.Function1;
  import static com.google.common.base.Preconditions.checkNotNull;
  
  public class OptionT&lt;M extends Monad,A&gt; {
     final M&lt;Option&lt;A&gt;&gt; run;
  
     public OptionT(final M&lt;Option&lt;A&gt;&gt; run){
         this.run = checkNotNull(run);
     }
  
     public &lt;B&gt; OptionT&lt;M,B&gt; map(Function1&lt;A,B&gt; f){
         return new OptionT&lt;M,B&gt;(run.map(o-&gt; o.map(f)));
     }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> I get the following compiler failure:</p>
  
  <pre><code>OptionT.java:15: error: unexpected type
      final M&lt;A&gt; run;
            ^
    required: class
    found:    type parameter M
    where M is a type-variable:
      M extends Monad&lt;Option&lt;?&gt;&gt; declared in class OptionT
  OptionT.java:17: error: unexpected type
      public OptionT(final M&lt;A&gt; run){
                           ^
    required: class
    found:    type parameter M
    where M is a type-variable:
      M extends Monad&lt;Option&lt;?&gt;&gt; declared in class OptionT
  </code></pre>