<div dir="ltr"><div><pre class="gmail-s90z9tc-8 gmail-hGaZWh"><code class="gmail-s90z9tc-7 gmail-cMUrmP"><font size="2"><font face="arial,helvetica,sans-serif">Thoughts on adding a newtype with the following Alternative instance?<br></font></font></code></pre><pre class="gmail-s90z9tc-8 gmail-hGaZWh"><code class="gmail-s90z9tc-7 gmail-cMUrmP"><font size="2"><font face="arial,helvetica,sans-serif">(The name chosen is a placeholder, I don't have any particular preference).<br></font></font></code></pre><pre class="gmail-s90z9tc-8 gmail-hGaZWh"><code class="gmail-s90z9tc-7 gmail-cMUrmP"><code class="gmail-s90z9tc-7 gmail-cMUrmP"><font size="4">newtype Mon f a = Mon { unMon :: f a } <br></font></code></code></pre><pre class="gmail-s90z9tc-8 gmail-hGaZWh"><code class="gmail-s90z9tc-7 gmail-cMUrmP"><font size="4">instance (forall a. Monoid (f a)) => Alternative (Mon f) where
empty = Mon mempty
(<|>) (Mon m1) (Mon m2) = Mon (m1 <> m2)</font></code></pre></div></div>