A recent patch introduced the feature that 'cabal install --dry-run' would print latest version numbers for packages to be installed. This failed if the package that was installed (the actual target, not a dep) wasn't uploaded to hackage:
cabal: Prelude.last: empty list
This patch fixes this.
(This is my first patch to cabal. If I did violate some coding or other guidelines, please tell me!)
fix printing of latest versions for packages that are not on hackage
Is lookupPackageName really guaranteed to return packages in version order?
Hmm... aha, I see that it is, according to https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/PackageIndex.hs#L99, but this really ought to be better documented...
The last was introduced in the previous patch. I don't know about lookupPackageName.
Right, I know last was from the previous patch, I just hadn't looked at the previous patch carefully so commented here. In any case, all is well.
Also, when I said "this ought to be better documented", I meant in Distribution.Client.PackageIndex, not here.
I see. Indeed, all is well. Thanks for merging.