title: How to "apply" a type-variable in Template Haskell?
body: <p>I'm passing a record with the following structure to a Template Haskell function:</p>
  
  <pre><code>module Editor.App where
  
  data WithMaybe
  data WithoutMaybe
  
  type family TypeSelector a b where
    TypeSelector WithMaybe b = Maybe b
    TypeSelector WithoutMaybe b = b
  
  data MyRecord a = MyRecord
    { field1 :: TypeSelector a Int
    , field2 :: TypeSelector a String
    }
  
  $(myTHFunction ''MyRecord)
  </code></pre>
  
  <p>Inside <code>myTHFunction</code> I'm calling <code>reify</code> and it is correctly giving me the following type-<code>Info</code>:</p>
  
  <pre><code>TyConI 
    (DataD 
      []
      Editor.App.MyRecord 
      [KindedTV a_6989586621679348600 StarT] 
      Nothing 
      [RecC Editor.App.MyRecord 
        [ ( Editor.App.field1
          , Bang NoSourceUnpackedness NoSourceStrictness
          , AppT  (AppT (ConT Editor.App.TypeSelector) (VarT a_6989586621679348600)) 
                  (ConT GHC.Types.Int) )
        , ( Editor.App.field2
          , Bang NoSourceUnpackedness NoSourceStrictness
          , AppT  (AppT (ConT Editor.App.TypeSelector) (VarT a_6989586621679348600)) 
                  (ConT GHC.Base.String) )
        ]
      ] 
      []
    )
  </code></pre>
  
  <p>However, in my application logic, I cannot proceed with an unapplied <code>KindedTV a_6989586621679348600 StarT</code>. So, my question is:</p>
  
  <ul>
  <li>how do I "apply" this type-variable in TH</li>
  <li>or, how do I apply it <em>before</em> passing it to TH. I tried <code>$(myTHFunction ''(MyRecord SomeSelector))</code> but that doesn't work.</li>
  </ul>