title: Which dictionary does GHC choose when more than one is in scope?
body: <p>Consider the following example:</p>
  
  <pre><code>import Data.Constraint
  
  class Bar a where
    bar :: a -&gt; a
  
  foo :: (Bar a) =&gt; Dict (Bar a) -&gt; a -&gt; a
  foo Dict = bar
  </code></pre>
  
  <p>GHC has two choices for the dictionary to use when selecting a <code>Bar</code> instance in <code>foo</code>: it could use the dictionary from the <code>Bar a</code> constraint on <code>foo</code>, or it could use the runtime <code>Dict</code> to get a dictionary. See <a href="https://stackoverflow.com/questions/29482576/turning-a-dict-into-a-constraint">this question</a> for an example where the dictionaries correspond to <em>different</em> instances. </p>
  
  <p>Which dictionary does GHC use, and why is it the "correct" choice?</p>