title: How to display a backtrace for an Error thrown in Haskell
body: <p>I'm currently debugging an algorithm I implemented in Haskell for my Diploma thesis. It seems to work correctly for most inputs, yet I found one input which makes GHC throw the error</p>
  
  <blockquote>
    <p>*** Exception: Map.find: element not in the map</p>
  </blockquote>
  
  <p>Since I have many Map lookups in my code, I need to find the line throwing this error to make any sense of it. I read through <a href="http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/ghci-debugger.html#ghci-debugger-exceptions" rel="noreferrer">this guide</a>, but although I set the flag <code>fbreak-on-exception</code> (and <code>-error</code>), all GHCi gives me after tracing the function I'm testing is:</p>
  
  <pre><code>[...]&gt; :trace test
  [...]
  Stopped at &lt;exception thrown&gt;
  _exception ::
    e = GHC.Exception.SomeException (GHC.Exception.D:Exception _
                                                           (GHC.Show.D:Show ...) ....)
                                (GHC.Exception.ErrorCall ['M',....])
  Unable to list source for &lt;exception thrown&gt;
  Try rerunning with :trace, :back then :list
  [&lt;exception thrown&gt;] [...]&gt; :history
  Empty history. Perhaps you forgot to use :trace?
  </code></pre>
  
  <p>Trying <code>:trace</code> again doesn't seem to help either.</p>
  
  <p>So, can someone tell me what is going wrong or offer another way of finding the offending line? Thanks in advance!</p>
  
  <p>PS: I'm using GHC version 7.0.3, so the linked guide should apply.</p>