[Haskell-cafe] namespaces for values, types, and classes
scook0 at gmail.com
Sun Nov 29 06:32:30 EST 2009
On Sun, Nov 29, 2009 at 8:42 AM, pbrowne <Patrick.Browne at comp.dit.ie> wrote:
> Question 3) Instances are not named so can they be imported?
Whenever you import a module, you automatically import all of its
instances as well. In fact, there is no way to *not* include instances
when importing a module.
Furthermore, any instances you import are automatically re-exported by
your own module. The upshot is that importing any module will
automatically include any instances defined in the transitive closure
of module dependencies, and there's nothing you can do to stop it.
(Yes, this is sometimes very irritating, though I appreciate some of
the motivations behind it. It's also one of the reasons why “orphan
instances” are discouraged.)
More information about the Haskell-Cafe