Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Opaque (to me) compilation error (Kim-Ee Yeoh)


----------------------------------------------------------------------

Message: 1
Date: Sat, 14 Nov 2015 16:44:24 +0700
From: Kim-Ee Yeoh <k...@atamo.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Opaque (to me) compilation error
Message-ID:
        <capy+zdsahjpcqbs2ncvmizwatiqnxpqsu+vpmzltcedu9mj...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sat, Nov 14, 2015 at 10:52 AM, Kim-Ee Yeoh <k...@atamo.com> wrote:

> 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
>

To elaborate, the error message comes from the compiler choking on the
monadic bind (>>=) that reveals itself in the desugared code.

The (>>=) results from desugaring

   file <- openBinaryFile filename ReadMode

into

   openBinaryFile filename ReadMode >>= \file -> ...

The compiler knows the type signature of (>>=), which wants to see

   IO Handle -> (Handle -> IO ByteString) -> IO ByteString

But the signature of the top-level function insists on

   IO Handle -> (Handle -> IO ByteString) -> ByteString

This is what's the compiler's trying to say.


-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151114/f1ead8c1/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 89, Issue 25
*****************************************

Reply via email to