Bug: instances from non-imported files used
"Neil Mitchell" <[email protected]> Sun, 4 Jun 2006 18:29:22 +0100
| Newsgroups | gmane.comp.lang.haskell.hugs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi,
With the following setup:
--
module A where
data A = A
--
module B where
import A
b = show A
--
module C where
import A
instance Show A where
show A = "A"
--
import B
import C
main = print "hello"
--
:load B fails, complaining that there is no Show instance for A, which
is correct.
However, :load Main succeeds, even though the module B that it imports
is valid. It seems that the show instance of C is used in B, even
though the module B does not import (even transitively) C.
GHC fails with:
./B.hs:6:4:
No instance for (Show A)
arising from use of `show' at ./B.hs:6:4-7
Probable fix: add an instance declaration for (Show A)
In the definition of `b': b = show A
Using Hugs May 2006 on Windows.
Thanks
Neil