<p dir="ltr">Sorry for the terrible title, but I think we should add something like the following to Data.Monoid (I already mentioned this in the discussion of a Monoid instance for ZipList).</p>
<p dir="ltr">newtype Appl f m = Appl (f m)</p>
<p dir="ltr">instance (Applicative f, Monoid m) => Monoid (Appl f m) where<br>
mempty = Appl $ pure mempty<br>
mplus (Appl x) (Appl y) = Appl $ liftA2 mplus x y</p>
<p dir="ltr">It may be possible to use coercions to improve mplus; I haven't tried it.</p>
<p dir="ltr">This type is the same as WrappedApplicative from semigroupoids, do it might be best just to give it that name.</p>