[Haskell-cafe] Why does this blow the stack?
dbenbenn at gmail.com
Fri Dec 21 17:19:04 EST 2007
On Dec 21, 2007 12:02 PM, Don Stewart <dons at galois.com> wrote:
> There's no good reason for the accumulator for Integer to be lazy,
> especially when you see that adding an upper bound (enumFromTo) or
> using Int uses a strict accumulator.
> I've filled a bug report and fix for this.
> there's an ad hoc sprinkling of strict and lazy Num ops for Integer
> through the base library, while Int is fairly consistently strict.
Thanks for fixing this. But doesn't GHC have strictness analysis?
Even if there was consistent strictness for Integer in the base
library, that wouldn't help for code not in the base library. In
other words, I want to be able to define
mysum :: (Num a) => [a] -> a
mysum = foldl (+) 0
in my own programs, and have GHC automatically make it strict if "a"
happens to be Int or Integer. Is there any chance of GHC getting that
More information about the Haskell-Cafe