21 Dec 23:19
Re: Why does this blow the stack?
David Benbennick <dbenbenn <at> gmail.com>
2007-12-21 22:19:04 GMT
2007-12-21 22:19:04 GMT
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. > > http://hackage.haskell.org/trac/ghc/ticket/1997 > > 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 ability?
RSS Feed