Why don't we have an "`import` what you use" commandment in Haskell?
I’ve recently come across Haskell PVP - Leaking instances, where there’s an example of
- a package C, which explicitly depends on package B, which in turns explicitly depends on package A (this means that C implicitly depends on A),
- a breakage of package C due to a major change in A (the removal of an instance) that reflects as non-major change in B (because it doesn’t use that instance).
The conlusion,
As a pragmatic solution, for now the PVP doesn’t required a major version bump in this case and instead leaves it to package C to add a dependency on package A to handle this situation.
seem to be more than pragmatic to me: when developing C, why should I not explicitly state my dependency on A?
I couldn’t help but thinking that that’s exactly the approach C++ uses, and that is encoded in the Core Guidelines - SF.10: Avoid dependencies on implicitly #included names. And C++ is anything but a niche/new/in-progress language, with even 5 years more than Haskell in its backpack, so its guidelines should not be dismissed lightly, imho.
Is there a reason why we don’t have an Avoid dependencies on implicitlyimported entities in Haskell?
By they way, is there any centralized Haskell Core Guidelines at the present time or in some roadmap?
Discussion in the ATmosphere