[Haskell] Separate Namespaces and Type Classes

Ketil Malde ketil+haskell at ii.uib.no
Thu Jul 8 07:20:59 EDT 2004


Stephan Herhut <S.A.Herhut at herts.ac.uk> writes:

> module B(bar) where
> instance Foo Integer where

> module C(tango)
> instance Foo Integer where

> import B(bar)
> import C(tango)

> But now, ghc complains about two instances of Foo Integer, although
> there should be none in the namespace main.

I suspect the problem is that instances are always exported and
imported, so that GHC sees both in Main, and complains.  Perhaps this
could be relaxed to allow your situation (where the class isn't used
directly in Main anyway)?

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell mailing list