Monads are too powerful: The expressiveness spectrum
5 days ago
- #monads
- #functional-programming
- #effect-systems
- Monads are powerful but may be too expressive for common needs, leading to hidden costs.
- Effect systems exist on a spectrum between expressiveness and static analysis, similar to dynamic vs. statically typed languages.
- Monads allow dynamic selection of effects based on previous results, enabling complex programs but limiting static analysis.
- Applicatives are less expressive than monads but allow better static analysis by fixing the sequence of effects beforehand.
- Selective Applicatives offer a middle ground, allowing some branching while still enabling program analysis.
- The trade-off between expressiveness and analyzability is key in choosing an effect system.
- Future explorations may focus on Category classes or Arrows to find a better balance.