Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 559
qazwsx Avatar asked Mar 05 '16 20:03

qazwsx


2 Answers

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.

like image 183
jamshidh Avatar answered Sep 27 '22 21:09

jamshidh


it seems the program happy is not installed in your system, therefore the package haskell-src-exts-1.17.1 (a dependency of a dependency of ghc-mod) which depends on it fails to install.

The common wisdom today, especially for beginners, is to not use the tool cabal-install, but to use stack for everything you need instead. including installing ghc itself. after downloading stack I think all you have to do is run stack install ghc-mod to install ghc-mod.

like image 34
soupi Avatar answered Sep 27 '22 21:09

soupi