[Haskell-beginners] Module import problem
Chaddaï Fouché
chaddai.fouche at gmail.com
Sun Sep 28 13:35:19 EDT 2008
2008/9/28 Casey Rodarmor <caseyrodarmor at gmail.com>:
> I must admit, I'm a little disappointed if that's the only way to get
> it to work. On the surface of things, I don't see why one can't just
> put a Module in some/arbitrary/directory, and then import it as
> some.arbitrary.directory.Module. The need to use a flag on the command
> line seems a little unnecessary.
>
> Can anyone give a little insight into why this decision was made?
Because that's how every language worked for decades for good reasons
: a library usually stay in one place on the filesystem while several
projects from several locations try to use it. So of course we would
prefer for each of these projects source to refer to the library in
the same fashion, especially given that it can be moved later on or
split between different buildtree or ...
Now, you may not be aware of that but you can register a library so
that GHC always know where to find its module, as long as you use
--make on the command line : ghc --make myScript.hs .
--
Jedaï
More information about the Beginners
mailing list