Using cabal with multiple GHC versions

后端 未结 5 1008
粉色の甜心
粉色の甜心 2020-12-18 19:50

I got both ghc6 and ghc7 on my desktop. To install new packages (for the specific ghc version), I use cabal with the flag --with-compiler=<

5条回答
  •  借酒劲吻你
    2020-12-18 20:46

    Now (cabal version 1.24.0.0), one can

    $ cabal install  -w path-to-ghc-executable-1 
    $ cabal install  -w path-to-ghc-executable-2
    

    to install packages separately for multiple different GHCs.

    (The meta-variable path-to-ghc-executable-i can be, like, /usr/bin/ghc-7.10.3, /usr/local/bin/ghc-8.4.3 etc.)

    How did I know? This command can be found via https://www.haskell.org/cabal/users-guide/installing-packages.html or cabal install --help.

    The post-condition looks like this: I installed QuickCheck for ghc-8.0.1 and ghc-6.12.1, then ~/.cabal/lib looks like:

    ➜  lib pwd      
    /home/lee/.cabal/lib
    ➜  lib tree -L 2
    .
    ├── x86_64-linux-ghc-6.12.1
    │   └── QuickCheck-2.8.2-GeOZQRSfeF7EtuZhBovRUq
    └── x86_64-linux-ghc-8.0.1
        └── QuickCheck-2.9.2-AzbjWrJo3WFD60ZxKurQ3s
    

提交回复
热议问题