3 ms·
> each time you actually want to do something (change the state of the world), you are severely beaten with a shower of monads that make side effects hell, even
by codygman 11y ago
> each time you actually want to do something (change the state of the world), you are severely beaten with a shower of monads that make side effects hell, even if the specific side effect you need is as trivial (and innocuous) as they come.
readFile "/etc/issue" >>= putStrLn
Man, I feel so beaten.
- tempodox 11y agoHa, just put this code into any old deeply nested function that's not already contaminated with the IO monad. Or try to do something that needs two monads at the same time.
- codygman 11y ago> Ha, just put this code into any old deeply nested function that's not already contaminated with the IO monad. Why would I want to do that? I could just pass the filepath to that function if it needed it, or if I want it to log messages I could use the writer monad. > Or try to do something that needs two monads at the same time. Monad transfomers aren't so hard: http://www.cs.virginia.edu/~wh5a/personal/Transformers.pdf http://www.cs.virginia.edu/~wh5a/personal/Transformers.pdf Edit: One of my favorite papers, I believe multiple monads are used in it: http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/ba...