How to call the quasiquoter for haskell syntax explicitly?
<p>I'm building an eDSL on top of HaTeX. The problem I'm facing is that I want to display Haskell expressions in my LaTeX document and I want to use the same Haskell expression to help generate the document.</p>

<p>The obvious answer is to copy and paste the expression so that it appears both quoted and live. I want to avoid that because the expression is subject to change.</p>

<p>What I'm imagining is a quasi quoter that both splices its content as it stands and output a string that represents it.</p>

<p>For example, here is what I would like to type in:</p>

<pre><code>document = do
    title "this is an example document"
    paragraph "This is normal text. We will now show the Haskell code that generates a table"
    [quoted| makeTable ["heading1","heading2"] ["cell1","cell2"] |]
</code></pre>

<p>and I would like the quasi quote to expand to:</p>

<pre><code>document = do
    title "this is an example document"
    paragraph "This is normal text. We will now show the Haskell code that generates a table"
    makeTable ["heading1","heading2"] ["cell1","cell2"]
    listing Haskell "makeTable [\"heading1\",\"heading2\"] [\"cell1\",\"cell2\"]"
</code></pre>

<p>For this, I need to write a QuasiQuoter:</p>

<pre><code>quoted :: QuasiQuoter
quoted = QuasiQuoter
     { quoteExp = \str -&gt; [e| $(_ str) &gt;&gt; listing Haskell $(lift str) |] }
</code></pre>

<p>I am unsure what to replace the hole with in <code>$(_ str)</code>. I need to replace it with the Haskell expression quasi quoter but I am unsure how to call it. If <code>e</code> was <code>e :: QuasiQuoter</code> I could fill the hole with <code>$(quoteExp e str)</code> but it unfortunately doesn't work. What should I fill it with?</p>