
The following combination of three modules breaks nhc98 v1.08: ===== First module ====== module M (T, foo) where newtype T = T Int foo :: Int -> T foo x = T (x + 1) ===== Second module ====== module N (foo) where import M (T) import qualified M (foo) data S = S T foo :: Int -> S foo y = S $ M.foo y ===== Third module ====== import N (foo) main = print $ const 42 (foo 100) ========================= Compile with nhc98 -c M.hs nhc98 -c N.hs nhc98 -c Main.hs to get Error when renaming:: Identifier foo defined 2 times. The problem is quite subtle. It is the combination of qualified import of `M.foo' in `N' and export of another `foo' in `N', where `N.foo' has a type that depends on `M.T'. Looking into `N.hi' there are indeed two definitions of `foo', where nhc doesn't seem to properly distinguish that they come from two different modules. Cheers, Manuel PS: In case anybody is wondering, I am still trying to get nhc to compile the basic compiler-support libraries that I need to port C->Haskell.

The following combination of three modules breaks nhc98 v1.08:
This is in fact another manifestation of the same import-namespace bug that showed up in your bug report about Ix.
import M (T) import qualified M (foo)
The combination of several imports of the same module, some qualified and some unqualified, is something nhc98 gets very wrong at the moment. In this case, I haven't got an easy workaround I'm afraid. Regards, Malcolm

Malcolm Wallace
The following combination of three modules breaks nhc98 v1.08:
This is in fact another manifestation of the same import-namespace bug that showed up in your bug report about Ix.
import M (T) import qualified M (foo)
The combination of several imports of the same module, some qualified and some unqualified, is something nhc98 gets very wrong at the moment. In this case, I haven't got an easy workaround I'm afraid.
Would importing everything qualified help? Manuel

import M (T) import qualified M (foo)
The combination of several imports of the same module, some qualified and some unqualified, is something nhc98 gets very wrong at the moment. In this case, I haven't got an easy workaround I'm afraid.
Would importing everything qualified help?
Yes, that is one way to work around the problem. Note however that nhc98 gets even qualified imports a little bit wrong - you will need to specify for instance import qualified M (M.T, foo) rather than the more natural import qualified M (T, foo) Regards, Malcolm
participants (2)
-
Malcolm Wallace
-
Manuel M. T. Chakravarty