Hacker News new | ask | show | jobs
by droningparrot 236 days ago
Haskell practically encourages this style of programming. Any function that touches IO needs to wrap outputs with an appropriate monad. It becomes easier to push all IO out to the edges of your program and keep your core purely functional with no monads
2 comments

Maybe JavaScript's colored functions[0] were trying to tell us something

[0] https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

I wish that's what people did, some codebases I've seen are messes of monad transformer stacks the likes of which you've never seen.

I mean, what if you want to do IO and have mutable data structures inside a do block? I'm afraid I'm going to have to prescribe you a monad transformer. Be careful of the side effects.