[Haskell-cafe] Alternative versus Monoid

Conor McBride conor at strictlypositive.org
Wed Dec 21 18:20:03 CET 2011





On 21 Dec 2011, at 14:07, Erik Hesselink <hesselink at gmail.com> wrote:

> On Wed, Dec 21, 2011 at 14:10, Bas van Dijk <v.dijk.bas at gmail.com>  
> wrote:

>  The semantics of Maybe are
>>
>> clear: it's failure-and-prioritized-choice.
>
> Are you sure?

Yes.

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

Types don't just give data a representation: types evoke structure.  
The data stored by Maybe can be made into a monoid in several ways,  
but the failure-management role of Maybe makes just one of them  
appropriate.

Cheers

Conor


>
> Erik
>
> [1] https://byorgey.wordpress.com/2011/04/18/monoids-for-maybe/
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list