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.
to the module head. For instance, a module with the head<br />
module stack(stackType, push, pop, newStack) where ...<br />
exports the entities stackType, push, pop, and newStack. <strong>An</strong> export list can contain the following<br />
entries:<br />
1. Names of datatypes: This exports only the datatype, whose name must be accessible in this<br />
module, but not the constructors of the datatype. The export of a datatype without its<br />
constructors allows the definition of abstract datatypes.<br />
2. Datatypes with all constructors: If the export list contains the entry t(..), then t must be<br />
a datatype whose name is in the module. In this case, the datatype t and all constructors of<br />
this datatype, which must be also accessible in this module, are exported.<br />
3. Names of functions: This exports the corresponding functions whose names must be accessible<br />
in this module. The types occurring in the argument and result type of this function are<br />
implicitly exported, otherwise the function may not be applicable outside this module.<br />
4. Modules: The set of all accessible entities imported from a module m into the current module<br />
(see below) can be exported by a single entry “module m” in the export list. For instance, if<br />
the head of the module stack is defined as above, the module head<br />
module queue(module stack, enqueue, dequeue) where ...<br />
specifies that the module queue exports the entities stackType, push, pop, newStack,<br />
enqueue, and dequeue.<br />
The unqualified names of the exported entities of a module must be pairwise different to avoid<br />
name clashes in the use of these entities. For instance, the module<br />
module m(f,ma.g) where<br />
import ma<br />
f x = ma.g x<br />
exports the names m.f and m.g, i.e., a qualified entity consists always of the name of the exported<br />
module followed by a dot and the unqualified name of the entity (without spaces between the dot<br />
and the names). If module ma also exports the entity f, then the export declaration<br />
module m(f,ma.f) where<br />
import ma<br />
f x = ma.f x<br />
is not allowed since the exported name m.f cannot be uniquely resolved.<br />
All entities defined by top-level declarations in a module are always accessible in this module,<br />
i.e., there is no need to qualify the names of top-level declarations. Additionally, the entities<br />
exported by another module can be also made accessible in the module by an import declaration.<br />
<strong>An</strong> import declaration consists of the name of the imported module and (optionally) a list of entities<br />
imported from that module. If the list of imported entities is omitted, all entities exported by that<br />
module are imported. For instance, the import declaration<br />
24