
Hi, As per the GHC manual (https://downloads.haskell. org/~ghc/master/users-guide/packages.html#the-ghc-package- path-environment-variable), packages which come earlier in the GHC_PACKAGE_PATH supersede the ones which come later. But that does not seem to be the case always. I am dealing with a case where I have multiple versions of a package in different databases. I am passing the list of package dbs via GHC_PACKAGE_PATH and ghc is picking the one which comes later. I expect it to pick the one which comes earlier in the path. In one case the package being picked from a package db which comes later is a newer version which makes me wonder if GHC always prefers a newer version. In another case both the versions are same but still GHC is using the one which come later in the package path. Are there any undocumented factors into play here? None of the packages is broken (as reported by ghc-pkg check). See https://github.com/commercialhaskell/stack/issues/1957#issuecomment- 239655912 for more details on where it is coming from. Thanks, Harendra

On 2016-08-16 07:08 AM, Harendra Kumar wrote:
As per the GHC manual (https://downloads.haskell.org/~ghc/master/users-guide/packages.html#the-ghc-... https://downloads.haskell.org/~ghc/master/users-guide/packages.html#the-ghc-...), packages which come earlier in the GHC_PACKAGE_PATH supersede the ones which come later. But that does not seem to be the case always.
I am dealing with a case where I have multiple versions of a package in different databases.
No, they don't mean multiple versions. They mean this: For example if two databases both have HUnit-1.1 (important: same name and same version number), then that's when all the talk about overriding is relevant. If you have different version numbers, the override rule doesn't apply, the rule that applies is the shadow rule: the highest version number wins. The shadow rule exists because there are two scenerios that you really don't want to behave differently: 1. You have both HUnit-1.1 and HUnit-1.2, and they are in the same database. 2. You have both HUnit-1.1 and HUnit-1.2, but they are in different databases.

Thanks Albert! That clarifies the behavior. We had discussion on this in
https://github.com/commercialhaskell/stack/issues/1957 as well where ezyang
provided clarifications on the behavior. We need to update the
documentation to make it more precise and accurate. I will file a ticket
for that.
-harendra
On 20 August 2016 at 06:37, Albert Y. C. Lai
On 2016-08-16 07:08 AM, Harendra Kumar wrote:
As per the GHC manual (https://downloads.haskell.org/~ghc/master/users-guide/packa ges.html#the-ghc-package-path-environment-variable <https://downloads.haskell.org/~ghc/master/users-guide/packa ges.html#the-ghc-package-path-environment-variable>), packages which come earlier in the GHC_PACKAGE_PATH supersede the ones which come later. But that does not seem to be the case always.
I am dealing with a case where I have multiple versions of a package in different databases.
No, they don't mean multiple versions. They mean this:
For example if two databases both have HUnit-1.1 (important: same name and same version number), then that's when all the talk about overriding is relevant.
If you have different version numbers, the override rule doesn't apply, the rule that applies is the shadow rule: the highest version number wins.
The shadow rule exists because there are two scenerios that you really don't want to behave differently:
1. You have both HUnit-1.1 and HUnit-1.2, and they are in the same database.
2. You have both HUnit-1.1 and HUnit-1.2, but they are in different databases. _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
participants (2)
-
Albert Y. C. Lai
-
Harendra Kumar