Looking at the documents for Control.Applicative , I notice that they have instance declarations for certain monads (like IO , Maybe and especially ST ), but there are no instances for MTAD monads like State and RWS . Instead, there seems to be a certain type of WrappedMonad that I assume covers all other cases.
So here are my questions:
Why are there no Applicative instances for monads MTL? The best answer that I could find on my own was a three-year article where someone implemented these instances and were briefly ignored.
What is the deal with WrappedMonad ? I found a post on Reddit that explains this briefly, but I think I'm confused about how to use it.
Ultimately, I would like to use State in an applicative style (as I recommended ), but if I have to mutate my code with WrappedMonad data WrappedMonad , then this doesn't seem to be a win. I could also completely ignore WrappedMonad and define the Applicative instance in the same way as I did for IO , ST , etc .: in terms of return and ap ... But this seems to be silly.
source share