title: Is ambiguous implicit value the only way we want to make the error existed in compilation time
body: <pre><code>trait Foo
  
  trait Bar extends Foo
  
  def doStuff[T &lt;: Foo](x: T)(implicit ev: T =!:= Foo) = x
  
  doStuff(new Foo{}) //ambiguous implicit value
  doStuff(new Bar)// successful
  </code></pre>
  
  <p>Implicit resolution is happening on compilation time, so in here I think there may be two implicit value with exactly same type to trigger <em>ambiguous</em> stuff.</p>
  
  <p>Right now, I am going to introduce shapeless into the team, my colleagues think this ambiguous implicit is not ideal, and I dont have strong argument about it. Is this only way to do it in order to make type safe in scala. If it is, what can I do to customize the error message ?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>In the shapeless, I want to make the sum of 2 NAT not equal to 7, I can code like this to make compilation fail.</p>
  
  <pre><code>def typeSafeSum[T &lt;: Nat, W &lt;: Nat, R &lt;: Nat](x: T, y: W)
           (implicit sum: Sum.Aux[T, W, R], error: R =:!= _7) = x
  
  typeSafeSum(_3, _4)
  </code></pre>
  
  <p>but the error message is ambiguous implicit value, how can I customize the error message ?</p>