[Haskell-cafe] Correspondence between libraries and modules

Brandon Allbery allbery.b at gmail.com
Sun Apr 22 22:45:19 CEST 2012

On Sun, Apr 22, 2012 at 13:15, Alvaro Gutierrez <radical at google.com> wrote:

> As I understand it, a library can provide any number of unrelated modules,
> and conversely, a single module could be provided by more than one library.
> I can see how this affords library authors more flexibility, but at a cost:
> there is no longer a single, unified view of the library universe. (The
> alternative would be for every module to be its own, hermetic library.) So
> I'm very interested in the rationale behind that aspect of the library
> system.

One reason:  modules serve multiple purposes; one of these is namespacing,
and in the case of interfaces to foreign libraries that may force a
division that would otherwise not exist.

More generally, making libraries and modules one-to-one means that either
modules exist solely for libraries, or libraries must be artificially
split.  Perhaps this indicates that modules have too many other functions,
but in that case you should propose an alternative system to replace them.

As to multiple libraries providing the same module:  the Haskell ecosystem
is still evolving and it's not always appropriate to give a particular
implementation sole ownership of a general module name.  Type families vs.
functional dependencies are an example of this (theoretically type families
were considered superior but to date they haven't lived up to it and
recently some cases were shown that fundeps can solve but type families
can't; parallel monad libraries based on both still exist).  New container
implementations have existed as standalone packages, some of which later
merge with standard packages while others are discarded.  Your proposal to
reject this reflects a static library ecosystem that does not exist.  (It
could be enforced dictatorially, but there is no Guido van Rossum of
Haskell and a mistake in an evolving system is difficult to fix after the
fact even with a dictator; we're already living with some difficult to fix
issues not related to modules.)

brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120422/9804a0c2/attachment.htm>

More information about the Haskell-Cafe mailing list