[GHC] #876: stack overflow on 'length . filter odd $ [0 ..
999999999]'
Bulat Ziganshin
bulat.ziganshin at gmail.com
Wed Aug 30 13:40:12 EDT 2006
Hello GHC,
Tuesday, August 29, 2006, 10:54:07 PM, you wrote:
> It makes sense to me that the above behaviour is seen: length is now a
> good
> consumer, but it generates 1+(1+(1+(1+... as it is consuming, and this
> causes a stack overflow. I don't think we can fix this while staying with
> fold/build fusion, so it looks to me like the patch should be reverted and
> the whole problem looked at post-6.6.
in general, for any function we can either implement
1) good consumer based on using foldr
2) tail-recursion
are you agree?
in particular, filterM, replicateM and other *M list operations (their
problems was mentioned earlier) can be implemented in first or second
way, but not both
may be this can be fixed with some smart rules, which selects first or
second implementation depending on context?
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Glasgow-haskell-users
mailing list