title: Confusion over the State Monad code on "Learn you a Haskell"
body: <p>I am trying to get a grasp on Haskell using the online book <a href="http://learnyouahaskell.com" rel="noreferrer">Learn you a Haskell for great Good</a>.</p>
  
  <p>I have, to my knowledge, been able to understand Monads so far until I hit the chapter introducing the <a href="http://learnyouahaskell.com/for-a-few-monads-more#state" rel="noreferrer">State Monad</a>.</p>
  
  <p>However, the code presented and claimed to be the Monad implementation of the State type (I have not been able to locate it in Hoogle) seems too much for me to handle.</p>
  
  <ul>
  <li><p>To begin with, I do not understand the logic behind it i.e why it should work and how the author considered this technique.( maybe relevant articles or white-papers can be suggested?)</p></li>
  <li><p>At line 4, it is suggested that function f takes 1 parameter.<br>
  However a few lines down we are presented with pop, which takes no parameters!</p></li>
  <li><p>To extend on point 1, what is the author trying to accomplish using a function to represent the State.</p></li>
  </ul>
  
  <p>Any help in understanding what is going on is greatly appreciated.</p>
  
  <h2>Edit</h2>
  
  <p>To whom it may concern,</p>
  
  <p>The answers below cover my question thoroughly.<br>
  One thing I would like to add though:</p>
  
  <p>After reading an article suggested below, I found the answer to my second point above:
  All that time I <em>assumed</em> that the pop function would be used like :<br>
     <code>stuff &gt;&gt;= pop</code> since in the bind type the second parameter is the function, whereas the correct usage is this <code>pop &gt;&gt;= stuff</code> , which I realized after reading again how do-notation translates to plain bind-lambdas.</p>