Misleading error message

Josef Svenningsson josefs at cs.chalmers.se
Fri Mar 5 12:36:03 EST 2004

Hi all,

This mail is a little story about a little guy called Josef and a little
adventure he had this week together with the compiler ghc. Although
exciting, this adventure took him several hours and Josef would have been
happier without it. So he appeals to the implementors to improve on the
situation so that others may not have to embark on the same journey.

OK, here's the story.

Josef has a rather large program which he is writing. It contains many
haskell modules spread out over several directories. Early this week Josef
decided to add yet another module. He decided to call this module
"InterfaceParse". So he created a file "InterfaceParse.lhs", filled it
with nice haskell code and imported it in another haskell file. Now, after
a while Josef realised that the name "InterfaceParse" was not in par with
his naming convention and decided to rename the module to
"InterfaceParser". Now, here is where the real adventure started. Josef
changed the name of the file to "InterfaceParser.lhs" but forgot to change
the module declaration in the file. In the file one could still read the
"module InterfaceParse ..."

Unknowing of his mistake, Josef carried on and changed the import to
importing the module "InterfaceParser" instead of "InterfaceParse". And to
make sure everything had gone right he recompiled his project. And behold!
The compiler complained. What did it say? The compiler said it could not
find the interface for the module "InterfaceParse"! Josef was very puzzled
by this. Was his import statement wrong? No. Then why was the compiler
looking for the interface "InterfaceParse" when it should look for
"InterfaceParser"? He started to experiment with importing other modules,
modules which didn't exist. All the time, whenever he was trying to import
a non-existing module the compiler would correctly complain that the
interface was missing. But as soon as he tried to import "InterfaceParser"
the compiler would complain that it couldn't find "InterfaceParse".

There where times when Josef thought someone was playing him a practical
joke. Maybe Simon Peyton Jones had come up with a devious plan on how to
make money from his compiler? By adding some obscure bug which would
trigger very rarely he could then ask people for money to fix the bug.

After much desperation and consulation with others Josef finally
discovered his error.

One might say that Josef should have understood his error right away, that
he should have checked his files better. But Josef believes that the error
message he got from the compiler was very misleading and led him away from
finding the true source of the error. Dear implementors, please improve
the error reporting in this case.

/Josef (first time he has ever written about himself in third person)

By the way, Josef is using ghc-6.2 on a solaris machine.

More information about the Glasgow-haskell-users mailing list