Proposal: Add Alternative adapter to Data.Monoid

Edward Kmett ekmett at gmail.com
Fri Oct 31 16:50:34 UTC 2014


Actually that feels like a very wrong place for it.

It may wind up having to go there, but I do care. =P

-Edward




On Fri, Oct 31, 2014 at 12:49 PM, David Feuer <david.feuer at gmail.com> wrote:

> And one more change: this can't go in Data.Monoid; it needs to go in
> Control.Applicative. I can't imagine anyone will care.
> On Oct 31, 2014 12:47 PM, "Edward Kmett" <ekmett at gmail.com> wrote:
>
>> The one change I'd offer is this:
>>
>> instance Alternative f => Monoid (Alt f a) where
>>   mempty = Alt empty
>> *  mappend = coerce ((<|>) :: f a -> f a -> f a)*
>>
>> That way it doesn't eta-expand (<|>).
>>
>> -Edward
>>
>>
>> On Fri, Oct 31, 2014 at 12:35 PM, Carl Howells <chowells79 at gmail.com>
>> wrote:
>>
>>> Oh right.  This is what I joined this list to propose in the first
>>> place, then forgot about.  Uh, do I get a vote? If I have one, I'm
>>> obviously +1 on the idea.
>>>
>>> On Thu, Oct 30, 2014 at 10:54 AM, Oliver Charles <ollie at ocharles.org.uk>
>>> wrote:
>>> > David Feuer <david.feuer at gmail.com> writes:
>>> >
>>> >> I found myself needing this type in my current overhaul of
>>> Data.Foldable,
>>> >> but it seems to be generally useful:
>>> >
>>> > +1, I can see myself wanting to reach for this.
>>> >
>>> > -- ocharles
>>> > _______________________________________________
>>> > Libraries mailing list
>>> > Libraries at haskell.org
>>> > http://www.haskell.org/mailman/listinfo/libraries
>>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141031/20a3d8dc/attachment.html>


More information about the Libraries mailing list