import/export bug

Ian Lynagh <[email protected]> Wed, 22 Oct 2003 14:08:00 +0100
Newsgroups gmane.comp.lang.haskell.nhc.bugs
Message-ID <[email protected]>
OK, with the following modules:

-----
module Bar (Bar(..)) where

data Bar = CBar | CBaz deriving Show
-----

-----
module Baz (Bar(..)) where

data Bar = CBar | CBaz deriving Show
-----

-----
module Foo (Bar(CBar,CBaz)) where

import qualified Bar
import Bar hiding (Bar(..))
import Baz
-----

nhc98 gives bogus errors:

$ nhc98     -c  -o Baz.o Baz.hs
$ nhc98     -c  -o Bar.o Bar.hs
$ nhc98     -c  -o Foo.o Foo.hs
======  Errors when renaming:
Constructor CBaz defined 2 times.
Constructor CBar defined 2 times.
$ 

hugs and ghc6 are happy. As a workaround I've found changing Foo's
import of Bar to

import Bar hiding (Bar(CBar,CBaz))

fixes it.


Thanks
Ian