How do I perform multiple computations on a long lazy list without introducing a space leak?<br><br>Doing a single computation like this works great:<br>
f = show . filter (> 1)<br><br>But if I do something like this:<br> f lst = show (filter (> 1) lst, filter (> 2) lst)<br>then it looks like GHC won't garbage collect list elements until the first filter has completely finished, and the second filter has iterated over them.
<br><br>Is there an easy way to feed each element into both functions, instead of feeding all elements to one function, and then all to the next?<br><br>Thanks,<br>Greg<br><br><br><br>