<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal">I can recall having had a need for this function a few times, so that’s cause for a +1 from me.</p>
<p class="MsoNormal">“compose” is not a bad name.</p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Libraries <libraries-bounces@haskell.org> on behalf of Elliot Cameron <eacameron@gmail.com><br>
<b>Sent:</b> Sunday, July 7, 2019 8:28:31 PM<br>
<b>To:</b> Tom Murphy<br>
<b>Cc:</b> Haskell Libraries<br>
<b>Subject:</b> Re: Proposal: composition util for Maps</font>
<div> </div>
</div>
<div>
<div dir="auto">+1 for "compose" and inclusion</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Jul 7, 2019, 2:17 PM <<a href="mailto:amindfv@gmail.com">amindfv@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto">
<div></div>
<div>+1 from me on the addition and the name "compose"</div>
<div><br>
</div>
<div>Tom</div>
<div><br>
El 7 jul 2019, a las 13:49, David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank" rel="noreferrer">david.feuer@gmail.com</a>> escribió:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div dir="auto">
<div>For what it's worth, I'm fairly confident that implementation is optimal, though I don't know how to even try to prove it. The only situation I see where we could obviously do better is when ab maps many keys to the same value and bc is very large compared
 to ab. In that case, it would make sense to store a "cache" of lookups into bc. But the constant factors for such an arrangement would be terrible, and there would be no benefit whatsoever in the general case. So I think the simple thing is the right thing
 here. As for names, I like compose. I support the proposal for the reason Alexandre gives: it feels like a fundamental operation.<br>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Jul 7, 2019, 1:22 PM Alexandre Esteves <<a href="mailto:alexandre.fmp.esteves@gmail.com" target="_blank" rel="noreferrer">alexandre.fmp.esteves@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>In <a href="https://github.com/haskell/containers/issues/647" rel="noreferrer noreferrer" target="_blank">https://github.com/haskell/containers/issues/647</a> I proposed the following util:<br>
</div>
<div><br>
</div>
<div>composition :: Ord b => Map b c -> Map a b -> Map a c<br>
composition bc ab = flip mapMaybe ab $ flip lookup bc<br>
<br>
Which has O(|ab| * log |bc|) performance. It's not particularly hard to write, but it does feel like a primitive-ish operation, and it's not obvious to me whether there's a faster implementation.</div>
<div><br>
</div>
<div>Other name suggestions</div>
<div>- (.)</div>
<div>- chain</div>
<div>- compose</div>
<div><br>
</div>
<div><br>
</div>
</div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" rel="noreferrer noreferrer" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>Libraries mailing list</span><br>
<span><a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a></span><br>
<span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank" rel="noreferrer">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a></span><br>
</div>
</blockquote>
</div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote>
</div>
</div>
</body>
</html>