Export lists in modules

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Feb 22 08:48:28 EST 2006


Johannes Waldmann <waldmann at imn.htwk-leipzig.de> wrote:

> Sounds like the perfect example to illustrate the point
> that information shouldn't be doubled in the first place.

Yes, I suppose one could argue that.

> Can you say why you want the type in the export list?

As a compact description of the module interface.  Many people already
do it, except that the signature is in a comment, and therefore not
checked.

> Or really, why you want an export list at all?

An explicit interface would be useful for many purposes besides
machine-checked documentation.  For instance, it could be used to
eliminate the hs-boot or hi-boot files used by some compilers when
dealing with recursive modules.

> Presumably because it constitutes the module's "interface",
> but it is an ad-hoc thing (one interface per module).
> We already have the concept of "type class"
> which gives us re-usable interfaces. Isn't that much better?

The near correspondence between type classes, modules, and records, is
well-known, yet still they are separate concepts in Haskell.  Perhaps
one day they will be merged.  However, in the meantime, for both records
and classes one is forced to give a signature to the contained
elements/methods.  For consistency, modules should do the same...

Regards,
    Malcolm


More information about the Haskell-prime mailing list