<div dir="ltr">I finally ended up defining a combinator <div><br></div><div><font face="monospace">flattenAndCompose :: (Category cat) => [cat a a] -> cat a a<br>flattenAndCompose = foldr (>>>) id </font><br></div><div><br></div><div>that can be used both for function composition and Kleislis since both (->) and Kleisli are instances of Category. I will take a look at Endo - thanks for the pointer ..</div><div><br></div><div>regards.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 7, 2020 at 11:26 PM Matthew Farkas-Dyck <<a href="mailto:strake888@gmail.com">strake888@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2/1/20, Jack Kelly <<a href="mailto:jack@jackkelly.name" target="_blank">jack@jackkelly.name</a>> wrote:<br>
> In Data.Monoid there is the 'Endo' newtype, which wraps functions of<br>
> type 'a -> a'. Is there an 'EndoM' variant, or is that something that's<br>
> usually created by putting other pieces together? Below is a sketch of<br>
> what I mean:<br>
><br>
> -- Maybe this is known by another name?<br>
> newtype EndoM f a = EndoM { appEndoM :: a -> f a }<br>
<br>
I define a general `Endo` type in the category package, here:<br>
<a href="http://hackage.haskell.org/package/category-0.2.5.0/docs/Data-Morphism-Endo.html" rel="noreferrer" target="_blank">http://hackage.haskell.org/package/category-0.2.5.0/docs/Data-Morphism-Endo.html</a><br>
<br>
Thus one can use `Endo (Kleisli m)`.<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Debasish Ghosh<br><a href="http://manning.com/ghosh2" target="_blank">http://manning.com/ghosh2</a></div><div><a href="http://manning.com/ghosh" target="_blank">http://manning.com/ghosh</a><br></div><div><br>Twttr: @debasishg<br>Blog: <a href="http://debasishg.blogspot.com" target="_blank">http://debasishg.blogspot.com</a><br>Code: <a href="http://github.com/debasishg" target="_blank">http://github.com/debasishg</a></div></div></div>