[Haskell-cafe] Re: cabal install HaXml installs wrong version unless I specify the version number

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat Nov 15 07:02:58 EST 2008


On Sat, 2008-11-15 at 12:39 +0100, Thomas Hartman wrote:
> When I specify
> 
> Build-Depends:  base, parsec, HaXml >= 1.19.4
> 
> in xml-parsec.cabal
> 
> it does install correctly.

Yes, saying what version it needs is a good thing. It's all guesses
otherwise.

> I guess what happens is that cabal install takes the earliest version
> of a package registered to try to build. I guess that's a reasonable
> default.

Actually it does that for specific packages, there's a file in the
hackage index called 'referred-versions':

base < 4
parsec < 3
HaXml == 1.13.*
QuickCheck < 2

These are all cases where there are large numbers of packages that fail
to specify an upper version constraint but break when built with the
later version of the package. In the case of HaXml it is also because
the 1.13 series is the one considered stable by its author.

> What seems unreasonable to me is that cabal continued to take the
> earlier version even after I hid it with ghc-pkg hide.

We cannot in general consider the hidden status of packages or we'd
never be able to use packages like 'ghc' which are always hidden.
Perhaps they could be used as soft preferences. If so should those come
before or after the preferences from the command line or from the
hackage index?

> My advice would be to improve the error message to read
> 
> "...    Could not find module `Text.XML.HaXml.Posn':
>       it is a member of package HaXml-1.19.4, which is hidden
>       It can be unhidden by adding
> 
>       Build-Depends: HaXml >= 1.19.4
> 
>   to xml-parsec.cabal"

Unfortunately we cannot easily do that. It is ghc that produces the
message about hidden packages but it is cabal that told ghc to hide all
the packages (other than those specified in the .cabal file). Some
people suggest that we should try parsing the ghc error messages to be
able to provide such hints but I don't think that's sensible.

> That leaves the issue of cabal upgrade not upgrading to the latest
> version available on hackage, which still feels like a real bug to me.

That's again down to the preferred versions in the hackage index. It
only comes into effect when you specify no version when asking for a
package. If you cabal install 'haxml >= 1.14' then it'll pick the latest
version.

When you "cabal install haxml", do you mean "install the default
version" or "install the latest experimental version"? Currently it
means the former. If there is general agreement it should mean the
latter then we can switch it.

Or perhaps it just needs an informational message to tell the user
whenever the default version is not the latest version.

cabal install haxml
Downloading HaXml-1.13.3...
Note: the recommended version is HaXml-1.13.3 but latest version is
HaXml-1.19, use cabal install haxml-1.19 if you want that version.

Or something like that.

Duncan



More information about the Haskell-Cafe mailing list