Bug: instances from non-imported files used
Neil Mitchell
ndmitchell at gmail.com
Sun Jun 4 13:29:22 EDT 2006
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
More information about the Hugs-Bugs
mailing list