title: Why are declaration splices not permitted inside delcaration brackets? Is there a workaround?
body: <p>I'm trying to make a quasiquoter that defines some simple sugar for type declarations.  The easiest way to do this is to just use some regular expressions to modify the input text string.  But when I compile this code outline code:</p>
  
  <pre><code>{-# LANGUAGE TemplateHaskell #-}
  {-# LANGUAGE QuasiQuotes #-}
  
  import Language.Haskell.TH
  import Language.Haskell.TH.Quote
  
  myquote = QuasiQuoter 
      { quoteDec = \d -&gt; [d| d |]
      }
  </code></pre>
  
  <p>GHC generates an error saying:</p>
  
  <pre><code>Declaration splices are not permitted inside declaration brackets
  </code></pre>
  
  <p>Why is this not allowed?  Is there any way to splice declarations?  It seems like the only alternative is reparsing the whole input declaration, which would just be obnoxious.</p>