Wed, 18 Oct 2000 19:03:05 -0700
email@example.com (Sengan Baring-Gould) wrote:
> mapM seems to be a memory hog (and thus also concatMapM).
> In the following eg:
> > main = mapM print ([1..102400] :: [Integer])
> memory usage climbs to 1.6M with ghc and needs -K20M
As a guess: since 'mapM print ([1..102400] :: [Integer])'
has type 'IO [()]', perhaps the result of the IO operation --
a list of 100K empty tuples -- is the culprit, even though
the result is never used.
Does 'mapM_ print ... ' (:: IO ()) perform any better?