Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Some good things have been said about why you shouldn't shy away from Haskell's laziness, but I feel that the original question remains unanswered.</p> <blockquote> <p>Function application in Haskell is non-strict; that is, a function argument is evaluated only when required.</p> </blockquote> <p>~ <a href="http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1260006.2" rel="nofollow">Haskell Report 2010 > Predefined Types and Classes # Strict Evaluation</a></p> <p>This is a little misleading, however. Implementations <em>can</em> evaluate function arguments before they are required, but only to a limited extent. You have to preserve non-strict semantics: so if the expression for an argument results an infinite loop, and that argument is not used, then a function call with that argument must not infinite loop.</p> <p>So you <em>are</em> allowed to implement Haskell in a way which is not fully "Lazy", but it nevertheless cannot be "Strict" either. This seems like a contradiction at first blush, but it is not. A few related topics you might want to check out:</p> <ul> <li><a href="http://csg.csail.mit.edu/pubs/haskell.html" rel="nofollow">Eager Haskell</a>, an implementation of the Haskell programming language which by default uses eager evaluation. I believe this is what you were thinking of (though it's not a branch of GHC).</li> <li><a href="http://en.wikipedia.org/wiki/Speculative_execution" rel="nofollow">Speculative Execution</a> and Speculative Parallelism (see e.g. the <a href="http://hackage.haskell.org/package/speculation" rel="nofollow">speculation</a> package).</li> <li><a href="http://research.microsoft.com/en-us/um/people/simonpj/papers/optimistic/" rel="nofollow">Optimistic Evaluation</a>, a paper by SPJ about speeding up GHC with strictness optimizations.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload