Error messages

Erik de Castro Lopo mle+hs at mega-nerd.com
Fri Jul 17 04:10:33 UTC 2020


Hi all,

Although it was many years ago I did spend soem time working on GHC
and I do know what a thankless task it is. I made a compliant about 
GHC error messages on an internal Slack channel and Mortiz encouraged
me to repeat it here.

I am incredibly happy about the quality of error messges for older 
more standard parts of Haskell, probably most things in Haskell98
and Haskell2010.

By way of contrast, error messages for some newer parts of Haskell are
incredibly poor. In fact, for the new parts, the error rmessages are 
often wrong, just defaulting to error messages for older parts of Haskell.

As an example (open source code in a public GH repo):

  src/Cardano/DbSync/StateQuery.hs:87:44: error:
      • Data constructor not in scope:
          QueryAnytime
            :: QueryHardFork xs0 (Interpreter xs0)
               -> Query
                    (CardanoBlock TPraosStandardCrypto)
                    (Interpreter (CardanoEras TPraosStandardCrypto))
      • Perhaps you want to add ‘QueryAnytime’ to the import list
        in the import of
        ‘Ouroboros.Consensus.HardFork.Combinator.Ledger.Query’
        (src/Cardano/DbSync/StateQuery.hs:49:1-116).
     |
  87 |   queryHistoryInterpreter connInfo (point, QueryAnytime GetInterpreter)
 
The suggestion is that I need to import `QueryAnytime` but just 20 line above I
have:

    import Ouroboros.....Query (QueryAnytime (..), QueryHardFork (GetInterpreter))

The problem is that `QueryAnytime` is defined as a pattern synonym. I have only
the tinest amount of experience using pattern synonyms and that error message
is not really useful.

I would like to suggest that a prerequesite for merging of new features would
be that it provides good error messages and more importantly does not provide
wrong or misleading error messages like the one above.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the ghc-devs mailing list