title: Is the dispatch of a Haskell TypeClass dynamic?
body: <p>Given the following Haskell code snapshot:</p>
  
  <pre><code>class Foo a where
     bar  :: a -&gt; ...
     quux :: a -&gt; ...
     ...
  </code></pre>
  
  <p>Where the value of a is determined at runtime - the class dispatches on this value. </p>
  
  <p>I'm assuming that the compiler can statically check the types at compile-time, and ensure that no invalid types can dispatch on it. </p>
  
  <p>Now if we compare this to a dynamic dispatch in Java:</p>
  
  <pre><code>interface Flippable {
    Flippable flip();
  }
  
  class Left implements Flippable {
    Right flip();
  }
  
  class Right implements Flippable {
    Left flip();
  }
  
  class Demo {
    public static void main(String args[]) {
      Flippable flippable = new Right();
      System.out.println(flippable.flip);
    }
  }
  </code></pre>
  
  <p><strong>Assumptions:</strong></p>
  
  <ul>
  <li>Haskell can dispatch on return type as well as multiple arguments making dispatch different to other languages. </li>
  </ul>
  
  <p>My question is: <strong>Is the dispatch of a Haskell TypeClass dynamic?</strong></p>