
Hi, While getting hat to work with ghc6 I've come across the following issue: If Bar.hs is this: ----- module Bar where class Bar a where bar :: a -> Bool ----- and Foo.hs is this: ----- module Foo where import qualified Bar data Foo = Foo instance Bar.Bar Foo where bar _ = True ----- then ghc 6.0.1 is happy enough, but nhc98 v1.16 doesn't like bar being used unqualified: $ make clean rm -f *.o *.hi $ make ghc ghc6 -c Bar.hs ghc6 -c Foo.hs $ make clean rm -f *.o *.hi $ make nhc nhc98 -c Bar.hs nhc98 -c Foo.hs ====== Errors when renaming: The identifier bar instantiated at 9:5 does not belong to this class. make: *** [nhc] Error 1 $ If I qualify bar: ----- module Foo where import qualified Bar data Foo = Foo instance Bar.Bar Foo where Bar.bar _ = True ----- then the roles are reversed: $ make clean rm -f *.o *.hi $ make ghc ghc6 -c Bar.hs ghc6 -c Foo.hs Foo.hs:11: Qualified name in function definition: Bar.bar make: *** [ghc] Error 1 $ make clean rm -f *.o *.hi $ make nhc nhc98 -c Bar.hs nhc98 -c Foo.hs $ hugs agrees with GHC 6 on both, and the report seems to agree on the latter (I haven't looked for what it says on the former, but it seems reasonable behaviour). Thanks Ian

Ian Lynagh
While getting hat to work with ghc6 I've come across the following issue:
We have encountered exactly the same issue ourselves when converting hat for ghc6.
hugs agrees with GHC 6 on both, and the report seems to agree on the latter (I haven't looked for what it says on the former, but it seems reasonable behaviour).
Yes, nhc98 is wrong wrt the Haskell'98 Report on this point. (It was a change between the original publication and the recently published revision.) The Report no longer permits an instance method definition to be qualified, because the method name without qualification is completely unambiguous in the context. It is on the ToDo list to be fixed for the next release. Regards, Malcolm
participants (2)
-
Ian Lynagh
-
Malcolm Wallace