[Haskell-cafe] Haskell maximum stack depth

Neil Mitchell ndmitchell at gmail.com
Fri Feb 8 07:23:12 EST 2008


> Yes, though testing stackGobbler with a large enough data set could
> be problematic for the very reason we've been discsussing.

Yes you are sure, or yes you tested and the results show than
neilGobbler is x% slower and consume y% more memory on specific test

> But let's say your hypothesis was correct.

My hypothesis isn't that the stack is slow.

> AFAICT neilGobbler isn't even entirely safe as an implementation of
> an eager take. There's nothing the Haskell standard to stop it being
> transformed into..
> neilGobbler :: Int -> [x] -> [x]
> neilGobbler n xs = length (take n xs) `seq` take n xs

Yes, but so much in the Haskell standard is also missing. I think in
this case you could reasonably argue that any compiler violating this
_is_ violating the Haskell standard as it was intended (albeit not as
it was written). You'll also find that the space behaviour of CAF's
isn't documented in Haskell, but if people changed it you'd break
quite a bit of the nofib suite.



More information about the Haskell-Cafe mailing list