On Sat, Nov 14, 2015 at 9:24 AM, Theodore Lief Gannon <tanuki@gmail.com> wrote:
You're missing IO in the type declaration, which I believe means that do block is running in the Id monad -- by inference, Id ByteString.
There's no running in the Id monad. The compiler doesn't understand monads the way we'd like it to. It's all very syntactic, namely:
1. the compiler desugars the do block into an expression
2. it typechecks the expression: no special understanding of the monad typeclass involved
3. and if there are errors, it reports them
What we're seeing is special handling for stage 3: reporting errors in a do-block. Sometimes it helps, sometimes it hinders. For instance, the derivation of this signature is confusing indeed: