From 9d2f09a91ea55bf55c25b8563870fa10c0ca8785 Mon Sep 17 00:00:00 2001 From: Tony Hannan Date: Tue, 19 Jul 2011 14:43:53 -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 a10d648..fc4bcbc 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. 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). +This is not good and unexpected. Fortunately, most occurences of this problem are 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