+1 in favor of generalizing Endo in Data.Monoid. <br><br>In my monoids library I have a Data.Monoid.Categorical that includes a &#39;GEndo&#39; generalized endomorphism over an arbitrary category and I would love to be able to remove it.<br>
<br>-Edward Kmett<br><br><div class="gmail_quote">On Wed, Jul 8, 2009 at 4:02 AM, Ross Paterson <span dir="ltr">&lt;<a href="mailto:ross@soi.city.ac.uk">ross@soi.city.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Tue, Jul 07, 2009 at 11:33:25PM -0400, <a href="mailto:roconnor@theorem.ca">roconnor@theorem.ca</a> wrote:<br>
&gt; I suggest adding a wrapper to make (a x x) a Monoid for any Category a<br>
&gt; and type x. This would be added to Control.Category.<br>
&gt;<br>
&gt; newtype EndoCategory a x = EndoCategory { runEndoCategory :: a x x }<br>
&gt;<br>
&gt; instance (Category a) =&gt; Monoid (EndoCategory a x) where<br>
&gt;   mempty = EndoCategory id<br>
&gt;   mappend (EndoCategory f) (EndoCategory g) = EndoCategory (f . g)<br>
<br>
</div>In Data.Monoid there is<br>
<br>
  newtype Endo a = Endo { appEndo :: a -&gt; a }<br>
<br>
  instance Monoid (Endo a) where<br>
        mempty = Endo id<br>
        Endo f `mappend` Endo g = Endo (f . g)<br>
<br>
and (-&gt;) is an instance of Category, so perhaps we should generalize Endo.<br>
<br>
The name EndoCategory seems wrong, as this won&#39;t be an instance of Category.<br>
Endomorphism?<br>
<div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br>