Behavior of GHC_PACKAGE_PATH

Albert Y. C. Lai trebla at vex.net
Sat Aug 20 01:07:14 UTC 2016


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-package-path-environment-variable
> <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.

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.


More information about the Glasgow-haskell-users mailing list