GHCi's :info to return all the visible instances, not just the ones imported from currently loaded files
Haskell report 5.4 says that instance visibility is transitively kept amongst module imports.
So, if A imports B, B imports C, and inside C.hs I have instance Eq C, it is enough to import A in Main.hs to have the Eq C instance visible. It is not required to import C directly.
When I use the import chain, the compiler works correctly, but ghci :info Eq doesn't report C as an instance, only if I import C directly.
This behavior is misleading, because if someone is not familiar with the specification, may believe after trying with :info that the instance is not transitively visible.
I attached a test for this issue, after unpacking you can use demo.sh to demonstrate the issue.
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |