How to fix : "passing non-escaping parameter to function expecting @escaping closure"
<p>I'm experimenting usage of closurse for First Order Predicate calculus, and
I intend to define the following function :</p>

<pre><code>func ASSUM&lt;U, V&gt;(p: @escaping Pred&lt;U&gt;) -&gt; (Pred&lt;U&gt;) -&gt; Pred&lt;(U, V)&gt; {
    return { q in AND1(p: p, q: q) }
}
</code></pre>

<p>that takes as parameter a predicate <code>p: Pred&lt;U&gt;</code>, where <code>Pred&lt;U&gt;</code> is a typealias for <code>(T) -&gt; Bool</code>: </p>

<pre><code>typealias Pred&lt;T&gt; = (T) -&gt; Bool
</code></pre>

<p>The return of <code>ASSUM</code> is a Predicate transformer closure of type <code>(Pred&lt;U&gt;)-&gt;Pred&lt;(U,V)&gt;</code>.</p>

<p>However the compiler return the following error :</p>

<blockquote>
<pre><code>Passing non-escaping parameter 'q' to function expecting an @escaping closure
</code></pre>
</blockquote>

<p>I understand that the function <code>AND1</code> as defined requests an escaping parameter :</p>

<pre><code>func AND1&lt;U, V&gt;(p: @escaping Pred&lt;U&gt;, q: @escaping Pred&lt;V&gt;) -&gt; Pred&lt;(U, V)&gt; {
    return { (x, y) in (p(x) &amp;&amp; q(y)) }
}
</code></pre>

<p>but I did not succeed in explicitly making <code>q</code> in <code>{ q in AND1(p: p, q: q) }</code> escaping. </p>

<p>How can I fix this?</p>