Should I prefer MonadUnliftIO or MonadMask for bracketting like functions? : <p>I'm currently building a new API, and one of the functions it currently provides is:</p>

<pre><code>inSpan :: Tracer -&gt; Text -&gt; IO a -&gt; IO a
</code></pre>

<p>I'm looking to move that <code>Tracer</code> into a monad, giving me a signature more like</p>

<pre><code>inSpan :: MonadTracer m =&gt; Text -&gt; m a -&gt; m a 
</code></pre>

<p>The implementation of <code>inSpan</code> uses <code>bracket</code>, which means I have two main options:</p>

<pre><code>class MonadUnliftIO m =&gt; MonadTracer m
</code></pre>

<p>or</p>

<pre><code>class MonadMask m =&gt; MonadTracer m
</code></pre>

<p>But which should I prefer? Note that I'm in control of all the types I've mentioned, which makes me slightly lean towards <code>MonadMask</code> as it doesn't enforce <code>IO</code> at the bottom (that is, we could perhaps have a pure <code>MonadTracer</code> instance).</p>

<p>Is there anything else I should consider?</p>
