1 Select instances from imported modules

From module A imports nothing not even instances. From module B imports instances of class AAA to be instances of class ZZZ instead, where all its methods are prefixed with "HHH." at the front. From module C, does not import instances of Num class for type String (this is only valid if type synonym instances is enabled, and means the same thing here) and Bool. From module D, the type named T is named TT when imported, for all functions using it, all instances, etc. If T is a type from a different module, then all function and instance from D using type T will make a new type TT instead. Instances for the type U are instead for a new type UU which is U wrapped in a newtype.

2 Override instances

Example:

import E hiding module C;

This hides instances in C which conflict with those of E, and hides names (except qualified)

Allows you to define newtype as part of an instance declaration, doing wrapping and unwrapping automatically.

3 Instance with imported modules

In general, you override instance, it doesn't affect functions from imported modules that use their own instances internally. However, there is some cases of overriding (this example requires scoped type variables):