<div dir="ltr">Thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 22, 2015 at 7:40 AM, Oleg Grenrus <span dir="ltr"><<a href="mailto:oleg.grenrus@iki.fi" target="_blank">oleg.grenrus@iki.fi</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And there are the ticket and the patch:<br>
<br>
<a href="https://ghc.haskell.org/trac/ghc/ticket/10107" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/10107</a><br>
<a href="https://phabricator.haskell.org/D673" target="_blank">https://phabricator.haskell.org/D673</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
> On 22 Feb 2015, at 12:07, Oleg Grenrus <<a href="mailto:oleg.grenrus@iki.fi">oleg.grenrus@iki.fi</a>> wrote:<br>
><br>
> To clarify the discussion:<br>
><br>
> Let's add the following instances:<br>
><br>
> A: Functor, Foldable, Traversable to Sum, Product, Dual, First, and Last<br>
> B: Data to everything in Data.Monoid (except Endo): Sum, Product, Dual, First and Last, All, Any, Alt<br>
> C: Applicative, Monad, MonadFix to Sum, Product, Dual, First and Last<br>
> D: Data to Identity<br>
><br>
> All seem to agree on A and B, C is "not sure", and D is new item.<br>
><br>
> - Oleg<br>
><br>
>> On 21 Feb 2015, at 17:34, Oleg Grenrus <<a href="mailto:oleg.grenrus@iki.fi">oleg.grenrus@iki.fi</a>> wrote:<br>
>><br>
>> I propose to add Functor, Applicative, Monad, Foldable, and Traversable and maybe even MonadFix instances to wrapper newtypes in the Data.Monoid module.<br>
>> The same way as in the semigroups package, e.g. <a href="https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min" target="_blank">https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min</a> <<a href="https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min" target="_blank">https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min</a>><br>
>><br>
>> Basically:<br>
>><br>
>> instance Functor Sum where<br>
>> fmap f (Sum x) = Sum (f x)<br>
>><br>
>> instance Foldable Sum where<br>
>> foldMap f (Sum a) = f a<br>
>><br>
>> instance Traversable Sum where<br>
>> traverse f (Sum a) = Sum <$> f a<br>
>><br>
>> instance Applicative Sum where<br>
>> pure = Sum<br>
>> a <* _ = a<br>
>> _ *> a = a<br>
>> Sum f <*> Sum x = Sum (f x)<br>
>><br>
>> instance Monad Sum where<br>
>> return = Sum<br>
>> _ >> a = a<br>
>> Sum a >>= f = f a<br>
>><br>
>> instance MonadFix Sum where<br>
>> mfix f = fix (f . getSum)<br>
>> _______________________________________________<br>
>> Libraries mailing list<br>
>> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
><br>
> _______________________________________________<br>
> Libraries mailing list<br>
> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br>
</div></div><br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div>