Static analysis and type classes in #haskell
- Applicative functors allow for static analysis because the terms you are composing are _not_ inside a lambda term `(a -> b) -> f a -> f b`
- This is not true for Monad. You need to "run" the computation to peel off a layer in order to analyze an inner term
- However, if you lift your monadic DSL to a Category, you might be able to use Kleisli composition _which_ does allow for some static analysis, at least of those Kleisli terms
- Bonus: Selective applicative functors are a hybrid, because you will need to "run" the computation, but since you know all the possible values there are, you can skip running the entire tree.