User Tools

Site Tools


confusing:lyahpop

This is an old revision of the document!


pop is already a stateful computation and push takes an Int and returns a stateful computation. Now we can rewrite our previous example of pushing 3 onto the stack and then popping two numbers off like this:

<code >

  import Control.Monad.State  
    
  stackManip :: State Stack Int  
  stackManip = do  
      push 3  
      a <- pop  
      pop

<>

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
You could leave a comment if you were logged in.
confusing/lyahpop.1616465417.txt.gz · Last modified: (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki