[Haskell-cafe] Extending the idea of a general Num to other types?

Simon Peyton-Jones simonpj at microsoft.com
Wed Sep 5 03:19:28 EDT 2007

| On that note, I've been finding GHC's type suggestions often worse
| than useless, and wish it wouldn't even bother to try -- even more
| confusing for new users to have the compiler suggest pointless things
| like declaring an instance of Num String or whatever. I'd prefer it
| if it could just tell me what *specific* part of an expression, which
| symbol even, the expected and inferred values differed. On the other
| hand, when trying to guess at operator precedence rules, the "applied
| to too many" and "applied to too few" errors are actually pretty handy.

It's difficult to make error messages helpful.  The best improvement mechanism I know is this:

        when you come across a case where GHC produces an
        unhelpful message, send it in, along with the program
        that produced it,


        your suggestion for the error
        message you'd like to have seen.

I don't promise instant action, but if you suffer in silence then nothing will improve.  Sending a message keeps it on our radar *and* provides an example to motivate improvements.  (Boiling the program down a bit is a help, so you don't have to send a massive tarball.)

Another thing that can be worth a try is to try your boiled-down program with Helium, whose error-message infrastructure has received much more conscious design attention than GHC's.


More information about the Haskell-Cafe mailing list