Hacker News new | past | comments | ask | show | jobs | submit login

I had to read Real World Haskell's chapter twice: http://book.realworldhaskell.org/read/monads.html to figure it out.

It's essentially a hidden argument that's passed around between the environment (the stuff in "do ... ") and the actions (the stuff called in "do ...", e.g, "x <- foo", foo would be the action). The argument is always the same type, and the each action can create a new one based off the old one. So you have IO, which is essentially "all interactions with the outside non-pure world", and the versions of it are "the world before I did this action" and "the world after I did this action".

Stuff that doesn't use the hidden arg doesn't have the action type (e.g., IO ()), so it has to be lifted, which essentially passes the old world state verbatim to the next step.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: