Namespace clashes

Malcolm Wallace
Fri, 17 Aug 2001 14:14:57 +0100

> However, I'm new enough to Haskell that I sometimes have a hard time
> figuring out what I've done wrong from the error messages.

Any time I get an error message I don't understand, the first thing
I do is to try a different compiler/interpreter, to see if it gives
a better message.

>	func x =
>	  do
>	    data <- readFile x
>	    return data
>	Where the problem is that I've mistakenly used the reserved word
> 'data' for a name binding. Here's the error message I get for that:
>	scratch.hs:3: Empty 'do' construct

For instance, nhc98 gives this (hopefully more informative) message
for the same error:

In file ./scratch.hs:
3:13 Found _data_ but expected one of: <string> <char> <rational> <integer>
     ( [ <varid> <conid> _case_ _if_ _do_ _let_ \ ` <varop> <conop> ~ _