[Haskell-cafe] Cabal version constraint seems to be ignored.

Carlo Hamalainen carlo at carlo-hamalainen.net
Fri Jan 31 09:26:05 UTC 2014

On 26/01/14 20:16, Albert Y. C. Lai wrote:
> It seems that you are using GHC API. Then your program starts a GHC
> session, which is not unlike an average ghci session, in particular:
> A. It will load and link libraries afresh during run time. This is
> independent of whatever your executable is linked with.
> B. And the default choice of libraries is, clearly: the newest
> unhidden version.
> Therefore, when your GHC session also has to work with compiled code
> built against older versions, there will be incompatibilities.

Ah, I see.

> What do you tell your users?

In my testing, using cabal sandboxes seems to work, but that's not
really a full solution.

> P.S. cabal-install goes out of its way to dictate library versions to
> ghc. It begins with -hide-all-packages, then it recites, one by one,
> -package base-, -package Cabal-1.16.0, -package
> text-,... Are you going to bother to do the same?

I did add some functionality like this recently:

(around line 108)

which is just using ghc-mod's API to do so. But I still run into the
original problem that I had before, at least when not using a sandbox.
I'm not sure what to do from here.

Carlo Hamalainen

More information about the Haskell-Cafe mailing list