[Haskell-beginners] audio generation

Dennis Raddle dennis.raddle at gmail.com
Sun May 1 00:16:41 UTC 2016


On Sat, Apr 30, 2016 at 11:00 AM, Daniel Bergey <bergey at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160430/cbd9762c/attachment.html>


More information about the Beginners mailing list