Module System
Simon Marlow
simonmar at microsoft.com
Thu Feb 23 06:21:22 EST 2006
On 22 February 2006 13:09, David Roundy wrote:
> On Tue, Feb 21, 2006 at 03:50:29PM +0000, Henrik Nilsson wrote:
>> I'm already somewhat unhappy about the way most present Haskell
>> tools map module names to path names (I'd generally prefer to have
>> the possibility to flatten my file hierarchies by, say, using dots
>> in my file names), but at least these assumptions are not in the
>> Haskell 98 language definition.
>
> I'd like to second this. I've been annoyed by the fact that ghc
> requires extra subdirectories in order to use hierarchical modules,
> and would be doubly annoyed if the language definition declared that
> this couldn't be fixed. jhc's behavior sounds nicer, but I'd rather
> there were the possibility of naming our haskell files whatever we
> liked.
Actually in GHC you can name your source files whatever you like, as
long as you tell GHC the names of all the source files on the command
line and use --make.
eg.
ghc --make My.Dotted.Module.hs Main.hs
works fine. Similarly with GHCi.
It's only when GHC has to actually *find* a source file for a module
that the hierarchical naming convention comes into play. There are two
reasons we don't allow the dotted convention: one is simplicity (the
description of where GHC looks for files is already a bit complex), and
the other is performance - GHC does a lot of looking for interface
files, and looking in more places might slow things down (I haven't
measureed it, though).
Cheers,
Simon
More information about the Haskell-prime
mailing list