Search code examples
haskellinstallationghc-mod

Cannot install ghc-mod due to 'happy' cannot be installed?


On Mac OS X, I'm not able to install ghc-mod due to that a dependency called 'happy' cannot be installed:

bash> cabal install ghc-mod                                                                                           
Resolving dependencies...
Configuring haskell-src-exts-1.17.1...
Failed to install haskell-src-exts-1.17.1
Build log ( /Users/meng/.cabal/logs/haskell-src-exts-1.17.1.log ):
Configuring haskell-src-exts-1.17.1...
setup-Simple-Cabal-1.22.5.0-x86_64-osx-ghc-7.10.3: The program 'happy' version
>=1.19 is required but it could not be found.
cabal: Error: some packages failed to install:
ghc-mod-5.5.0.0 depends on haskell-src-exts-1.17.1 which failed to install.
haskell-src-exts-1.17.1 failed during the configure step. The exception was:
ExitFailure 1
hlint-1.9.31 depends on haskell-src-exts-1.17.1 which failed to install.

Any idea?


Solution

  • For some reason, cabal doesn't install executable dependencies, but you can get around this by installing by hand.

    cabal install happy
    

    then proceed with the original installation.


    This problem generally doesn't go away with stack either, but the solution is similar

    stack install happy
    

    then continue with the installation.