two problems exportation/importation of field labels.

Hello! I think NHC does not properly handle exports and imports of field labels. Problem 1 -------- The following two modules seem to be legal according to the Haskell 98 report (Sec.5.2, p. 66): ================================================================== module See1 ( D( Undef, Def, value ) ) where data D = Undef | Def{ value :: Int } ------------------------------------------------------------------ module See2 ( foo ) where import See1 ( D( Undef, Def, value ) ) foo :: D -> Int foo d = case d of Undef -> error "no value" Def{} -> value d ================================================================== Both GHC and Hugs accept this, but NHC reports an error: hmake -d../nhc See2.hs nhc98 -c -d ../nhc See1.hs ==================================== In file: ./See1.hs: 1:16 Found ( but expected one of ) , If one changes the heading of See1 to module See1 ( D( Undef, Def ), value ) where then one gets hmake -d../nhc See2.hs nhc98 -c -d ../nhc See2.hs ==================================== In file: ./See2.hs: 3:13 Found ( but expected a {-end-of-definition-or-EOF-} Problem 2 --------- There are no syntactic problems when one uses another, equally legal form: ================================================================== module See1 ( D( Undef, Def ), value ) where data D = Undef | Def{ value :: Int } ------------------------------------------------------------------ module See2 ( foo ) where import See1 ( D( Undef, Def ), value ) foo :: D -> Int foo d = case d of Undef -> error "no value" Def{} -> value d ================================================================== Again, this is accepted both by GHC and Hugs. But now NHC has another bone to pick: hmake -d../nhc See2.hs nhc98 -c -d ../nhc See2.hs ==================================== Error when renaming:: Identifier value defined 2 times. To make this go away, one has to change the importation clause to import See1 ( D( Undef, Def ) ) Now everything is OK, and NHC does not complain about the occurrence of "value" in "foo"! Regards, -- Feliks

I think NHC does not properly handle exports and imports of field labels.
You are correct, and thank you for the bug report. Both of the problems you report have already been fixed in CVS, and will be available in the next release of nhc98. We plan to release version 1.12 very soon. Regards, Malcolm
participants (2)
-
Feliks Kluzniak
-
Malcolm Wallace