[Haskell-cafe] Alternative versus Monoid

Erik Hesselink hesselink at gmail.com
Wed Dec 21 15:07:25 CET 2011

On Wed, Dec 21, 2011 at 14:10, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> On 16 December 2011 16:26, Yves Parès <limestrael at gmail.com> wrote:
>> "1) What about the First type? Do we {-# DEPRECATE #-} it?"
>> Personnaly, I'm in favor of following the same logic than Int:
>> Int itself is not a monoid. You have to be specific: it's either Sum or
>> Mult.
>> It should be the same for Maybe: we remove its instance of Monoid, and we
>> only use First and Last.
> The reason you need to be specific with Int is that it's not clear
> which semantics (sum or product) you want. The semantics of Maybe are
> clear: it's failure-and-prioritized-choice.

Are you sure? There are (at least) four Monoid instances for Maybe
[1]. With a direct instance for Maybe and its Dual you have only
covered two.


[1] https://byorgey.wordpress.com/2011/04/18/monoids-for-maybe/

More information about the Libraries mailing list