class instance lost during re-export & packaging
I have a package P that contains a class instance specified in one module P.M and re-exported in packaging module P (one that gathers & re-exports for the whole P package). When I import the package module P in a test module, Under ghc-6.6, my instance is not found. If the test module also says "import P.M()", the instance is found. Oddly, I only have this problem with classes defined in a package other than P. In ghci, after loading the module successfully, if I comment out the "import P.M()" and re-load, the instance is found. Is this behavior known, and perhaps even intended? Is there anything I can do to make sure my instance gets packaged up with module P? Thanks, - Conal
Conal Elliott wrote:
I have a package P that contains a class instance specified in one module P.M and re-exported in packaging module P (one that gathers & re-exports for the whole P package). When I import the package module P in a test module, Under ghc-6.6, my instance is not found. If the test module also says "import P.M()", the instance is found. Oddly, I only have this problem with classes defined in a package other than P.
That sounds like a bug. It might be an instance of the last bullet point here: http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs.html#bugs-ghc but I suggest you open a ticket for it and we'll check.
In ghci, after loading the module successfully, if I comment out the "import P.M()" and re-load, the instance is found.
This one is definitely an instance of the known bug above. GHCi just keeps collecting instances from packages and never throws any away. Cheers, Simon
participants (2)
-
Conal Elliott -
Simon Marlow