[Haskell-cafe] instance Monoid a => Monad ((,) a)

Neil Mayhew neil_mayhew at users.sourceforge.net
Mon Aug 5 20:57:26 UTC 2019


On 2019-08-05 2:33 p.m., Jinxuan Zhu wrote:

    … Bool can be monoid by either || or && operations, which would lead
    to ambiguity if Bool is monoid by default.

    You can:

     1. use Maybe Unit instead
     2. (overkill) Define AndMonoid Bool newtype and use DeriveVia and
        coerce

|Data.Monoid| from |base| already has |Any| and |All| for this.

​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190805/d4179262/attachment.html>


More information about the Haskell-Cafe mailing list