2 ms·
Haskell started using them because it allows a pure language to express side effects. Beyond that, they're a pretty general and reusable way of looking at data
by mmaniac 2y ago
Haskell started using them because it allows a pure language to express side effects.
Beyond that, they're a pretty general and reusable way of looking at data structures that nest.
- koolala 2y agoBurritos have side effects?
- Y_Y 2y agoMany impure functions take place in Taco Bell bathrooms
- juunpp 2y agoA "side effect" is generally the behaviour that can be modeled by a Monad under chaining (join), and is not necessarily IO (although IO is a Monad). For a burrito, the side effect of join is the union of burrito contents.
- int_19h 2y agoImagine eating a burrito bite by bite as you're performing a pure computation in your head. This would be captured as `Burrito Result` monad, where `Result` is the value that you're computing, and `Burrito` is the partially consumed burrito at the end of the computation. By representing it as a monad, you can pass said partially consumed burrito to someone else for them to compute while continuing to eat it, or you can delegate your computation to other people, passing burrito from one to the other. ~ So, yes, I suppose.
- chuckadams 2y agoA Human Centipede is a Monoid in the category of digestive tracts.
- koolala 2y agoDigital Spreadsheets lets you do this from multiple angles.