Proposals for changes to searching behaviour

Simon Marlow simonmar@microsoft.com
Tue, 10 Dec 2002 10:44:18 -0000


> >   - We could provide the ability to specify a module prefix=20
> to associate
> >     with a directory in the search path.  For example, you could say
> >     that the directory '.' is associated with the module prefix
> >     "Graphics.Rendering.OpenGL" and avoid having to place=20
> your sources
> >     in the directory Graphics/Rendering/OpenGL.
> >=20
> >     I'm not sure what syntax we'd use for this.  Henrik suggested
> >     placing the module prefix in square brackets before the=20
> directory,
> >     eg.
> >   ghc -i '-i[Graphics.Rendering.OpenGL].'
>=20
> Does that mean I can refer to X.hs as=20
> [Graphics.Rendering.OpenGL(.Graphics.Rendering.OpenGL)*/]X.hs ?-)
> Probably no problem with Haskell's explicit imports.

Good point, which should be cleared up.  We don't intend GHC to have any
knowledge of relative pathnames and the meaning of '.' or '..'.  So the
meaning of an import path [Graphics.Rendering.OpenGL]D would be simply
this:  when looking for a module's source/interface, if the module name
is of the form Graphics.Rendering.OpenGL.M, then we look for D/M.hs.  If
it doesn't exist, we move on to the next entry in the search path.

Cheers,
	Simon=20