<div dir="ltr"><div style class="markdown-here-wrapper" id="markdown-here-wrapper-615020"><p style="margin:1.2em 0px!important">Cute trick; I've been wanting a way to get a product out of a set of folds.  +1</p>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 29, 2013 at 6:13 PM, Edward Kmett <span dir="ltr"><<a href="mailto:ekmett@gmail.com" target="_blank">ekmett@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">A decent argument in favor is there really isn't another viable instance for it. Being able to glue together folds with (<>) never occurred to me.<div>

<div><br></div><div>+1 from me</div><span class="HOEnZb"><font color="#888888"><div><br></div>
<div>-Edward</div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 29, 2013 at 12:01 PM,  <span dir="ltr"><<a href="mailto:haskell@nand.wakku.to" target="_blank">haskell@nand.wakku.to</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I think this a Monoid instance on Const would be useful. The motivation comes<br>
from ‘lens’, where folds come out as (a -> Const a a) -> s -> Const a s. This<br>
instance, together with the Monoid a => Monoid (r -> a) instance, allows folds<br>
themselves to be an instance of Monoid, allowing for some really pretty code.<br>
<br>
Example of the instance body:<br>
<br>
> instance Monoid a => Monoid (Const a b) where<br>
>   mempty = Const mempty<br>
>   mappend (Const a) (Const b) = Const (mappend a b)<br>
<br>
Examples of it being used together with lens:<br>
<br>
>>> "Hello, world!" ^.. mconcat [ix 2, ix 7, ix 1]<br>
"lwe"<br>
<br>
Discussion Period: 2 weeks<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div>