title: Haskell MonadState implement put with modify
body: <p>I want to implement put with modify</p>
  
  <pre><code>    put :: s -&gt; m ()
      modify :: (s -&gt; s) m s
  </code></pre>
  
  <p>when i do <br></p>
  
  <pre><code>    put s = modify $ const((), s)
  </code></pre>
  
  <p>i get the error,<br>
  Expected type: m ()<br>
  Actual type: m ((), s)<br>
  I have tried something like this</p>
  
  <pre><code>    modify $ const((), s) &gt;&gt;= \x -&gt; return (fst x)
  </code></pre>
  
  <p>to get the expected type m() <br>
  but this solution does not work</p>
  
  <p>could someone explain to me how you can implement put by using modify?<br>
  Thank you for your time and help.</p>