
3 Aug
2006
3 Aug
'06
2:03 p.m.
Gabriel Sztorc wrote:
Hello,
I want to filter a list with a predicate that returns a IO value, something that filterM is supposed to do. The problem is, filterM overflows the stack for really big lists and I couldn't come up with a simple replacement for filterM that would work for lists of any size (the truth is, I can't come up with anything at all :).
The question is: how to do it? Any help is appreciated.
What is the predicate computing? Does it have side effects? Does the order of evaluation matter? A dangerous solution is to use unsafeInterleaveIO or unsafePerformIO to change your predicate to look like a pure function...