title: Debugging functional code in Scala
body: <p>Debugging functional code is definitely more tricky than debugging imperative code. See discussions <a href="https://stackoverflow.com/questions/1894636/do-some-functional-programming-constructs-reduce-debuggability">here</a>, <a href="https://stackoverflow.com/questions/1303794/how-is-debugging-achieved-in-a-lazy-functional-programming-language">here</a> and <a href="https://stackoverflow.com/questions/2696912/debugging-f-code-and-functional-style">here</a>. "Functional" debugging should support inspecting the  return value of functions/closures/monads. Do any debuggers/IDEs have (plan to have) the ability to inspect intermediate return values?</p>
  
  <p>For example, to debug this line in Scala, I should be able to step through 4 function invocations and inspect the returned value at each step before returning <code>r</code></p>
  
  <pre><code>val r=(ls filter (_&gt;1) sort (_&lt;_) zipWithIndex) filter {v=&gt;(v._2)%2==0} map{_._1}
  </code></pre>