title: Scala Map, implict symbol key to string
body: <p><strong>UPDATE</strong><br>
  All the answers are good here, but @senia's does so the most directly, without need for additional steps. Will this lead to bugs, possibly, but when using Map[Symbol, T] convention in hundreds of methods, a 1-step implicit conversion prior to map creation is preferred (avoids Symbol Map key permgen storage). At any rate, here's the pimp:</p>
  
  <pre><code>class SymbolProvidesPair(i: Symbol) { def -&gt;[T](s: T) = (i.toString.tail, s) }
  @inline implicit def symbol2String(i: Symbol) = new SymbolProvidesPair(i)
  </code></pre>
  
  <p><strong>Original</strong><br>
  It bothers me a bit using string keys in Maps, just slows me down and is, IMO, not as syntactically easy on the eyes as symbol keys.</p>
  
  <pre><code>val map: Map[String, Int] = Map("strings" -&gt; 1, "blow" -&gt; 2)
  val map: Map[String, Int] = Map('symbols -&gt; 1, 'rock -&gt; 2)
  </code></pre>
  
  <p>So, I created an implicit to scratch my itch:</p>
  
  <pre><code>implicit def symbolKey2String[A &lt;: Symbol, B](x:(A,B)) = (x._1.toString, x._2)
  </code></pre>
  
  <p>Couple things:<br>
  1) is this the correct signature? The above works, but <code>A &lt;: Symbol</code> I take to mean, something that derives from Symbol vs. something that equals Symbol.</p>
  
  <p>2) I'll be using this when I manually type out Maps; i.e. just for convenience. Am I going to hit any snags with this implicit? It seems edge case enough to not cause issues (like string2Int, for example), but not sure if I'm missing something.</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong><br>
  Ok, well #1 I can just actually say what I mean, <code>[Symbol, B]</code> instead of <code>[A &lt;: Symbol, B]</code></p>
  
  <p>But now I find myself with another issue, the symbol-to-string implicit boxes me into a corner of sorts as I then have to explicitly define Map[String, Type] for all new Maps (i.e. lose the nice compiler type inference) in order to be able to use symbol keys.</p>
  
  <p>How then to get the best of both worlds, Map symbol keys, but with inferred [String, Type] when not specifying the type signature? i.e. have the compiler infer Map[String, Int] when I do:</p>
  
  <pre><code>val map = Map('foo -&gt; 1)
  </code></pre>