[Haskell-cafe] module names

Ketil Malde ketil.malde at bccs.uib.no
Fri Dec 16 00:21:36 EST 2005


"Scherrer, Chad" <Chad.Scherrer at pnl.gov> writes:

> module Main where
>   module A where
>   module B where

> in a single file. This example is straight from chapter 5 of the Report,
> and no mention is made (that I could find) about modules needing to be
> in separate files. But this won't load in ghci!

IIRC, the standard deliberately doesn't specify any requirements as to
the file organization of code, and leaves it up to implementations.  I
think the reason file names and module names must coincide (with the
exception of module Main, which may be in an arbitrarily named file),
is simply that it makes it easier for the compiler (and the programmer
as well) to locate them.

Perhaps now that we have hierarchical namespaces we could allow a
"module directory" (i.e. any prefix up to a dot) to be represented
either as a directory (like it is now), or as a multi-module file?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list