On Sat, Apr 30, 2016 at 11:00 AM, Daniel Bergey <bergey@alum.mit.edu> wrote:
The entire topic of space use in Haskell is not simple, but the part you
need here may be.  As long as GHC can tell that values already written
to disk may be garbage collected, memory use is quite reasonable.

For example, here's a short program that prints a long-ish list:

xs :: [Double]
xs = map cos [1..1e7]

main :: IO ()
main = traverse_ print $ map sin xs




Thanks. I'll see if this works for me. My question right now is, what is traverse_print? Is that the same as

main = traverse print . map sin $ xs

?

I'm guessing IO is traversable and for some reason you don't want to use mapM.

D