[Haskell-cafe] GHC predictability

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Tue May 13 09:55:28 EDT 2008


On 2008 May 12, at 22:18, Jeff Polakow wrote:

> Then, I immediately blow my stack if I try something like:
>
>     mean [1..1000000000].
>
> The culprit is actually sum which is defined in the base libraries  
> as either a foldl or a direct recursion depending on a compiler  
> flag. In either case, the code is not strict enough; just trying to  
> compute:
>
>      sum [1..10000000]

There's also an insufficient-laziness issue with enumerations in at  
least some versions of the standard library, IIRC.  meaning that just  
saying [1..10000000] can introduce a space leak that can lead to a  
stack blowout.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080513/5948ffcf/attachment.htm


More information about the Haskell-Cafe mailing list