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

2

7

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?

Romero answered 5/3, 2016 at 20:40 Comment(1)
I know it is a bit more to learn, but consider using either stack or cabal sandboxes, for the latter you best do a cabal get ghc-mod then cd into the ghcmod directory and there you do cabal sandbox init this will make your life with Haskell way more easier. Using stack is even better, but there's already answers recommending that.Elate
E
11

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.

Ewen answered 5/3, 2016 at 20:58 Comment(0)
R
5

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.

Regeniaregensburg answered 5/3, 2016 at 20:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.