[Haskell-cafe] Alternative versus Monoid

Yves Parès limestrael at gmail.com
Fri Dec 16 16:28:05 CET 2011


Sorry, I meant Sum and Product for the monoid equivalents of a Num instance.

2011/12/16 Yves Parès <limestrael at gmail.com>

> "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.
>
>
> 2011/12/16 Bas van Dijk <v.dijk.bas at gmail.com>
>
>> On 16 December 2011 05:26, Brent Yorgey <byorgey at seas.upenn.edu> wrote:
>> > I, for one, would be
>> > quite in favor of changing the current Monoid (Maybe a) instance to
>> > correspond to the failure-and-prioritized-choice semantics
>>
>> So lets do this. Some questions:
>>
>> 1) What about the First type? Do we {-# DEPRECATE #-} it?
>>
>> 2) What about the Last type? It could be deprecated in favor of Dual.
>>
>> 3) Do we need a new type (like the current Maybe) for lifting
>> semigroups into a Monoid? IMHO we don't since the semigroup package
>> does a better job with the Option type (like Brent mentioned).
>>
>> 4) How much code will break from this change?
>>
>> 5) Anyone up for proposing this to libraries at haskell.org?
>>
>> Regards,
>>
>> Bas
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111216/b75d8272/attachment.htm>


More information about the Haskell-Cafe mailing list