<div dir="ltr">+1 from me. I've written this type at least a dozen times in various projects.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 27, 2018 at 10:22 AM, Daniel Cartwright <span dir="ltr"><<a href="mailto:chessai1996@gmail.com" target="_blank">chessai1996@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I see this as being generally (as in, to the users of Haskell as a whole) useful:<div><br></div><div>newtype Ap f a = Ap { getAp :: f a }</div><div>  deriving (Applicative, Eq, Foldable, Functor, Generic, Generic1</div><div>                ,Monad, Ord, Read, Show, Traversable)</div><div><br></div><div>Some hand-written instances:</div><div>instance (Applicative f, Semigroup a) => Semigroup (Ap f a) where</div><div>  (Ap x) <> (Ap y) = Ap $ liftA2 (<>) x y</div><div><br></div><div>instance (Applicative f, Monoid a) => Monoid (Ap f a) where</div><div>  mempty = Ap $ pure mempty</div></div>
<br>______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">-Andrew Thaddeus Martin</div>
</div>