title: Using -XGeneralizedNewtypeDeriving with -XMultiParamTypeClasses
body: <p>The following code results in an error:</p>
  
  <pre><code>{-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses, StandaloneDeriving #-}
  
  class Module a b where
      (*&gt;) :: a -&gt; b -&gt; b
  
  data D
  newtype DWrapper = DW D    
  instance Module D D    
  deriving instance Module DWrapper DWrapper
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>No instance for (Module DWrapper D) arising from a use of ‘Main.*&gt;’
  In the first argument of ‘GHC.Prim.coerce’, namely
    ‘(Main.*&gt;) :: DWrapper -&gt; D -&gt; D’
  In the expression:
      GHC.Prim.coerce ((Main.*&gt;) :: DWrapper -&gt; D -&gt; D) ::
        DWrapper -&gt; DWrapper -&gt; DWrapper
  In an equation for ‘*&gt;’:
      (*&gt;)
        = GHC.Prim.coerce ((Main.*&gt;) :: DWrapper -&gt; D -&gt; D) ::
            DWrapper -&gt; DWrapper -&gt; DWrapper
  When typechecking the code for  ‘Main.*&gt;’
    in a derived instance for ‘Module DWrapper DWrapper’:
    To see the code I am typechecking, use -ddump-deriv
  </code></pre>
  
  <p>So GHC is looking for a <code>Module DWrapper D</code> instance to derive the requested <code>Module D D</code> instance. This is reasonable I guess, but not what I intended. Is there a way to tell GHC which instance to derive from? How does GNTD work on MPTCs?</p>