mapping module identifiers to URLs (was RE: [Haskell] URLs in haskellmodule namespace)

Simon Marlow simonmar at microsoft.com
Wed Mar 30 06:02:30 EST 2005


On 29 March 2005 22:47, S. Alexander Jacobson wrote:

> Here is a strawman proposal for replacing -i.
> 
>    The compiler/interpreter should accept a "Modules" file that maps
>    thid party module identifiers to URLs at which source may be found.
>    Here is a strawman file format:
> 
>     #moduleId     url(s)
>     Foo.Bar.*     http://domain.com/package-v1.0.hkg
>     http://domain.com/package-v2.0.hkg Foo.Bar      
> http://domain2.com/package2.hkg 
> 
>    The urls on any line enumerate all packages that have compatible
>    implementations of the module identified by the module identifier
>    on that line.
> 
>    Each imported packages may contain at most one Modules file.  The
>    implementation attempts to find module URL implementation agreement
>    among all imported packages.  If that fails, foreign Modules files
>    are interpreted as being included at the line where they were
>    imported.  Later URLs for the same moduleId override earlier ones.
> 
>    The implementation should give a warning if third party packages
>    give conflicting module locations.
> 
> Note: Yes, I know about Cabal's Build-Depends, but it doesn't serve
> the need described here.

It is true that Cabal's Build-Depends doesn't do everything you want it
to, but your proposal also duplicates some of the functionality of
Build-Depends, and makes it so that there are two places where
dependencies are stored.  We should only have to specify dependencies
once.

Rather than have a separate file to list dependencies, I'd like to see
Cabal extended.  Downloading and installing dependencies isn't something
that should be done by the compiler: we have layered the package system
in such a way that the compiler only needs to understand what packages
are installed and which ones to use, and the other tools are responsible
for arranging to download, build, and install packages.

I don't think it's necessary to specify dependencies with module
granularity.  This just increases the number of possible error cases,
without adding functionality.  If you want to specify which module
imports require each package dependency, then do it with a comment.  The
tools can tell you if any dependencies are redundant.

Suppose that:

   - Package dependencies in Build-Depends could be specified using
     URLs.

   - Cabal could download, build, and install dependencies without any
     user intervention.

That does everything you want, doesn't it?  I don't think everyone would
want this level of automation (eg. if you want your system's native
package manager involved in package installation), but that's a separate
matter.

Cheers,
	Simon


More information about the Haskell mailing list