Hacker News new | ask | show | jobs
by knitHacker 2669 days ago
I think this is the why monads are hard to understand. It's hard to come up with a general example of why they are useful and anything beyond they significantly simplify a lot of common cases you run into with functional programming quickly get convoluted.

I didn't really understand monads until I ran into really long / repetitive / ugly code when writing Haskell and then reading a book and realizing they could be used to simplify the parts of my code that frustrated me.

I think the biggest reason they are useful is because data and the container around it can be treated independently and gives a good common interface for container behavior.