title: How would you (re)implement iterate in Haskell?
body: <pre><code>iterate :: (a -&gt; a) -&gt; a -&gt; [a]
  </code></pre>
  
  <p>(As you probably know) <code>iterate</code> is a function that takes a function and starting value. Then it applies the function to the starting value, then it applies the same function to the last result, and so on. </p>
  
  <pre><code>Prelude&gt; take 5 $ iterate (^2) 2
  [2,4,16,256,65536]
  Prelude&gt; 
  </code></pre>
  
  <p>The result is an infinite list. (that's why I use <code>take</code>). 
  My question how would you implement your own <code>iterate'</code> function in Haskell, using only the basics (<code>(:)</code> <code>(++)</code> lambdas, pattern mataching, guards, etc.) ?</p>
  
  <p>(Haskell beginner here)</p>