From a1ed175bc2a9b12c0dbe40737dc4fcd1c40d3c50 Mon Sep 17 00:00:00 2001 From: Tony Hannan Date: Mon, 18 Jul 2011 16:33:12 -0400 Subject: [PATCH] small edit to article --- doc/Article2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Article2.md b/doc/Article2.md index 86bc9a6..b7fd375 100644 --- a/doc/Article2.md +++ b/doc/Article2.md @@ -54,7 +54,7 @@ Stepping through the execution on a small list shows an unevaluated expression b => 3 + 3 => 6 -This is not good and unexpected. How can you detect these problems without analyzing every expression for unevaluated expression build up? The answer is: [profile](http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/profiling.html) your application if it is not performing as expected. It will tell you how much time and space different functions are consuming. Once you find the troublesome code, the solution is easy: Force the evaluation of the unevaluated expression by marking it as *strict* (*eager*). This is done by prefixing its variable with `!` and adding language extension [*BangPatterns*](http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/bang-patterns.html). +This is not good and unexpected. Fortunately, many of these problems may be recognized by the compiler's [strictness analyzer](http://www.haskell.org/haskellwiki/GHC_optimisations#Strictness_analysis) and fixed automatically. However, it is not guaranteed. So how can you detect these problems without analyzing every expression for unevaluated expression build up? The answer is: [profile](http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/profiling.html) your application if it is not performing as expected. It will tell you how much time and space different functions are consuming. Once you find the troublesome code, the solution is easy: Force the evaluation of the unevaluated expression by marking it as *strict* (*eager*). This is done by prefixing its variable with `!` and adding language extension [*BangPatterns*](http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/bang-patterns.html). {-# LANGUAGE BangPatterns #-} reduce op id list = red id list where red !acc list = case list of [] -> acc; head:tail -> red (head `op` acc) tail