title: Iterate over list in haskell?
body: <p>I'm writing an audio program in Haskell using Portaudio. I have a function that generates a list of samples I'd like to play, and I'm trying to play them using the following snippet inside main:</p>
  
  <pre><code>curSamps &lt;- return (chunk 1 (sineWave 440 44100))
  forever $ do
    Right numSampsAvail &lt;- getStreamWriteAvailable paStream
    Right NoError &lt;- writeStream paStream curSamps numSampsAvail
    curSamps &lt;- return (drop numSampsAvail curSamps)
  </code></pre>
  
  <p>sineWave is a function I've created to generate an infinite list of Int16 samples of a sinewave at a specified frequency and sample rate. </p>
  
  <p>When I debug this code, by replacing the audio output code with a putStrLn, it prints all 0s, which is the first sample from the function.</p>
  
  <p>How can I iterate over this list with the audio output functions? I don't think I can use recursion or a map.</p>
  
  <p>Edit: Code copying mistake</p>