[Haskell-beginners] Opaque (to me) compilation error
Kim-Ee Yeoh
ky3 at atamo.com
Sat Nov 14 03:52:37 UTC 2015
On Sat, Nov 14, 2015 at 9:24 AM, Theodore Lief Gannon <tanuki at 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:
IO System.IO.Handle
-> (System.IO.Handle -> IO Data.ByteString.ByteString)
-> Data.ByteString.ByteString
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151114/31516e12/attachment-0001.html>
More information about the Beginners
mailing list