21 Dec 19:02
Re: Why does this blow the stack?
Derek Elkins <derek.a.elkins <at> gmail.com>
2007-12-21 18:02:31 GMT
2007-12-21 18:02:31 GMT
On Fri, 2007-12-21 at 09:56 -0800, David Benbennick wrote: > On Dec 21, 2007 9:51 AM, Justin Bailey <jgbailey <at> gmail.com> wrote: > > I think its [1..] which is building up the unevaluated thunk. Using > > this definition of dropTest does not blow the stack: > > It also works if you do [(1::Int) ..] !! n, but not with [(1::Integer) ..] !! n > > Sounds like GHC is being smart about strictness for Ints, but doesn't > know that Integer is equally strict. If that's right, it's a bug in > GHC. It is a bug in GHC. From http://darcs.haskell.org/packages/base/GHC/Enum.lhs enumFrom (I# x) = eftInt x maxInt# where I# maxInt# = maxInt -- Blarg: technically I guess enumFrom isn't strict! ... eftInt x y | x ># y = [] | otherwise = go x where go x = I# x : if x ==# y then [] else go (x +# 1#)
RSS Feed