<div dir="ltr">Good point Al, I avoided Set for similar reasons. Feel free to substitute Dictionary for String.CharacterView in my example. Unrelated to this proposal I would like to see a mapValues method on Dictionary.<div><br></div><div>The main point though was that you can&#39;t unambiguously resolve the return type. A similar example to yours, is that without higher kind types myMap on CollectionType could allow this to compile:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace, monospace">let oops: String? = [1,2,3].myMap {&quot;\($0)&quot;}</font></div></blockquote><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 17, 2015 at 1:13 AM, Al Skipp <span dir="ltr">&lt;<a href="mailto:al_skipp@fastmail.fm" target="_blank">al_skipp@fastmail.fm</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><div><blockquote type="cite"><div><blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">let myDictionary: [String:Int] = [&quot;test&quot;: 1]</font></div><div><font face="monospace, monospace">var otherDictionary = myDictionary.myMap { ($0, Float($1)) }</font></div></blockquote><blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">// does not fail:</font></div></blockquote><blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">assert(otherDictionary is [String:Float])</font></div></blockquote></div></blockquote></div><br></span><div>The trouble with Dictionary is that peculiar things can happen if we can map over keys and return a Dictionary.</div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:#bb2ca2">let</span> dict = [<span style="color:#d12f1b">&quot;a&quot;</span>:<span style="color:#272ad8">1</span>, <span style="color:#d12f1b">&quot;b&quot;</span>:<span style="color:#272ad8">2</span>, <span style="color:#d12f1b">&quot;c&quot;</span>:<span style="color:#272ad8">3</span>]</div><div style="margin:0px"><span style="font-family:Menlo;font-size:11px;color:rgb(187,44,162)">let</span><font face="Menlo"><span style="font-size:11px"> dict2 = </span></font><span style="font-family:Menlo;font-size:11px;color:rgb(79,129,135)">dict</span><font face="Menlo"><span style="font-size:11px">.</span></font><span style="font-family:Menlo;font-size:11px;color:rgb(61,29,129)">map</span><font face="Menlo"><span style="font-size:11px"> { (</span></font><span style="font-family:Menlo;font-size:11px;color:rgb(209,47,27)">&quot;x&quot;</span><font face="Menlo"><span style="font-size:11px">, $1 * </span></font><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)">2</span><font face="Menlo"><span style="font-size:11px">) } // [</span></font><font color="#d12f1b" face="Menlo"><span style="font-size:11px">“x</span></font><font face="Menlo"><font color="#d12f1b"><span style="font-size:11px">”</span></font><span style="font-size:11px">:</span><font color="#272ad8" style="font-size:11px">6]</font></font></div></div><div style="margin:0px;font-size:11px;font-family:Menlo"><br></div><div style="margin:0px">We start with a Dictionary with 3 keys and end up with a Dictionary with 1 key! As the order of the keys is unknown, we have no idea what the value of the key will be either, it might be 6, 4 or 2. </div><div style="margin:0px"><br></div><div style="margin:0px">Swift currently avoids this bedlam by returning an Array of tuples when ‘mapping’ a Dictionary. Strictly speaking this isn’t ‘map’ in the Functor sense, but then again Dictionary is a rogue that refuses to obey the Functor laws anyway.</div></div></blockquote></div><br></div>