title: Why there can be only one implementation of a typeclass for any given type parameter?
body: <p>I'm reading the FP for Mortals book which has following line:</p>
  
  <blockquote>
    <p>There can only be one implementation of a typeclass for any given type parameter, a property known as <em>typeclass coherence</em>. Typeclasses look superficially similar to algebraic interfaces from the previous chapter, but algebras do not have to be coherent.</p>
  </blockquote>
  
  <p>I do not understand this paragraph fully. Suppose we have following typeclass:</p>
  
  <pre class="lang-scala prettyprint-override"><code>trait Ordering[T] {
    def compare(x: T, y: T): Int
  }
  </code></pre>
  
  <p>I can create two implementations for the <code>Int</code> type like this:</p>
  
  <pre class="lang-scala prettyprint-override"><code>val ord1: Ordering[Int] = new Ordering[Int] {
    def compare(x: Int, y: Int): Int =
      if (x &gt; y) 1 else if (x == y) 0 else -1
  }
  
  val ord2: Ordering[Int] = new Ordering[Int] {
    def compare(x: Int, y: Int): Int =
      if (x &gt; y) -1 else if (x == y) 0 else 1
  }
  </code></pre>
  
  <p>What do authors mean when they say that typeclass can have only one implementation? It doesn't apply for instances of the typeclass as we can have multiple ones for the same type. To what it is applied? Also why ADTs are not coherent in that sense?</p>