[Haskell-cafe] Flattening tail recursion?
simonpj at microsoft.com
Mon Dec 13 03:45:44 EST 2004
I have not been following the details, but yes, the strictness analyser
only runs when you say -O, and without strictness analysis you can get
different space behaviour. Sometimes more, sometimes less. In this
case, strictness analysis helps.
| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Jules
| Sent: 10 December 2004 21:38
| To: GoldPython
| Cc: Henning Thielemann; haskell-cafe
| Subject: Re: [Haskell-cafe] Flattening tail recursion?
| On 10 Dec 2004, at 20:33, GoldPython wrote:
| > Just compiled this with -O and it ran with no stack overflow.
| > Evidently, no `seq` needed for this one. Using ghc 6.2.2.
| > countLines l = countLines' 0 l
| > countLines' n  = n
| > countLines' n (_:ls) = countLines' (n + 1) ls
| That's presumably the answer. GHC's strictness analyser *can* cope
| this situation but only under -O... whereas most of us where testing
| under ghci...
| Confirmation from one of the Simons?
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
More information about the Haskell-Cafe