Curry: An Integrated Functional Logic Language
Curry: An Integrated Functional Logic Language
Curry: An Integrated Functional Logic Language
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
module main where<br />
import m1 hiding (f)<br />
import m2<br />
...<br />
The name f in the main module refers to the entity m2.f since the name f is not imported from<br />
m1 by the hiding declaration. The hiding clause effects only unqualified names, i.e., the entity<br />
m1.f is still accessible in the body of the main module. Therefore, a hiding clause has no effect in<br />
combination with a qualified import. Similarly to export declarations, a datatype t in a hiding<br />
clause hides only the datatype (but not its constructors) whereas the form t(..) hides the complete<br />
datatype including its constructors.<br />
The effect of several import declarations is cumulative, i.e., if an entity is hidden in one import<br />
declaration, it can still be imported by another import declaration. For instance, if module mt<br />
exports a datatype t together with its constructors, then the import declarations<br />
import mt hiding (t(..))<br />
import mt (t)<br />
imports all entities exported by mt but only the name t of the datatype without its constructors,<br />
since the first hiding clause imports everything from mt except the complete datatype t and the<br />
second import specification additionally imports the name of the datatype t.<br />
Imported modules can also be given a new local name in the import declaration. For instance,<br />
the declaration<br />
import m(f) as foo<br />
enables access to the name f (provided that it is not in conflict with another entity with the same<br />
name) and foo.f but not to m.f. This local renaming enables the abbreviation of long module<br />
names and the substitution of different modules without changing the qualifiers inside a module.<br />
Although each name refers to exactly one entity, it is possible that the same entity is referred<br />
by different names. For instance, consider the modules defined by<br />
module m(f) where<br />
f :: Int -> Int<br />
...<br />
module m1(m.f) where<br />
import m<br />
...<br />
module m2(m.f) where<br />
import m<br />
...<br />
together with the main module<br />
module main where<br />
import m1<br />
import m2<br />
...<br />
26