<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 7, 2014 at 11:14 AM, Xiaojun "Phil" Hu <span dir="ltr"><<a href="mailto:phil@cnphil.com" target="_blank">phil@cnphil.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> I found it relatively hard to reason about the time complexity of Haskell programs.</blockquote></div>

<br>Is that the question you really want to ask? <br><br>If it is, the answer is trivial: if it's O(f(n)) time in other languages, it's also O(f(n)) time in Haskell. (Note: space is a different story.)<br><br>But what typically people want to know is: why is my program so slow? <br>

<br>You wonder about the constants covered up by Big-Oh. <br><br>And so you're going to have to get acquainted with<br><br>0) lambda calculus<br>1) graph reduction, <br>2) the G-machine, and <br>3) the spineless-tagless variant thereof. <br>

<br>You're also going to have to learn to read Core and understand some of the higher order core-to-core optimizations that GHC performs.<br><br><br clear="all"><div>-- Kim-Ee</div>
</div></div>