10
votes

I tried to install haddock by running the following command cabal install haddock but I run through the following problem.

leonzo@lion:~/opt$ cabal install haddock
Resolving dependencies...
Configuring haddock-2.11.0...
Building haddock-2.11.0...
Preprocessing library haddock-2.11.0...
unused terminals: 1
[ 1 of 31] Compiling Haddock.Backends.HaddockDB ( src/Haddock/Backends/HaddockDB.hs, dist/build/Haddock/Backends/HaddockDB.o )
[ 2 of 31] Compiling Haddock.Backends.Xhtml.Types ( src/Haddock/Backends/Xhtml/Types.hs, dist/build/Haddock/Backends/Xhtml/Types.o )
[ 3 of 31] Compiling Haddock.Convert  ( src/Haddock/Convert.hs, dist/build/Haddock/Convert.o )
[ 4 of 31] Compiling Paths_haddock    ( dist/build/autogen/Paths_haddock.hs,     dist/build/Paths_haddock.o )
[ 5 of 31] Compiling Haddock.GhcUtils ( src/Haddock/GhcUtils.hs, dist/build/Haddock/GhcUtils.o )
[ 6 of 31] Compiling Haddock.Version  ( src/Haddock/Version.hs, dist/build/Haddock/Version.o )
[ 7 of 31] Compiling Haddock.Lex      ( dist/build/Haddock/Lex.hs, dist/build/Haddock/Lex.o )
[ 8 of 31] Compiling Haddock.Types    ( src/Haddock/Types.hs, dist/build/Haddock/Types.o )
[ 9 of 31] Compiling Haddock.Utils    ( src/Haddock/Utils.hs, dist/build/Haddock/Utils.o )
[10 of 31] Compiling Haddock.Options  ( src/Haddock/Options.hs, dist/build/Haddock/Options.o )
[11 of 31] Compiling Haddock.Backends.Xhtml.Themes ( src/Haddock/Backends/Xhtml/Themes.hs, dist/build/Haddock/Backends/Xhtml/Themes.o )
[12 of 31] Compiling Haddock.Backends.Xhtml.Utils ( src/Haddock/Backends/Xhtml/Utils.hs, dist/build/Haddock/Backends/Xhtml/Utils.o )
[13 of 31] Compiling Haddock.Backends.LaTeX ( src/Haddock/Backends/LaTeX.hs, dist/build/Haddock/Backends/LaTeX.o )
[14 of 31] Compiling Haddock.Backends.Hoogle ( src/Haddock/Backends/Hoogle.hs, dist/build/Haddock/Backends/Hoogle.o )
[15 of 31] Compiling Haddock.Interface.AttachInstances ( src/Haddock/Interface/AttachInstances.hs, dist/build/Haddock/Interface/AttachInstances.o )
[16 of 31] Compiling Haddock.Interface.Rename ( src/Haddock/Interface/Rename.hs, dist/build/Haddock/Interface/Rename.o )
[17 of 31] Compiling Haddock.Doc      ( src/Haddock/Doc.hs, dist/build/Haddock/Doc.o )
[18 of 31] Compiling Haddock.Parse    ( dist/build/Haddock/Parse.hs, dist/build/Haddock/Parse.o )
[19 of 31] Compiling Haddock.Interface.ParseModuleHeader ( src/Haddock/Interface/ParseModuleHeader.hs, dist/build/Haddock/Interface/ParseModuleHeader.o )
[20 of 31] Compiling Haddock.Interface.LexParseRn ( src/Haddock/Interface/LexParseRn.hs, dist/build/Haddock/Interface/LexParseRn.o )

src/Haddock/Interface/LexParseRn.hs:67:52:
Not in scope: type constructor or class `SafeHaskellMode'
cabal: Error: some packages failed to install:
haddock-2.11.0 failed during the building phase. The exception was:
ExitFailure 1
leonzo@lion:~/opt$

Is there someone who knows how to deal with this mess ?

Edit my ghc version is 7.4.1

1
What version of ghc do you have and when did you last run cabal update?asm
my ghc version is 7.4.1 and the last cabal update was done now, without any result of the problem.Fopa Léon Constantin

1 Answers

10
votes

Nowadays, the haddock version is tightly bound to the GHC version. For ghc-7.4.1, the corresponding haddock version was 2.10.0.

The SafeHaskellMode type that is referred to in the error message was added in ghc-7.4.2, so you cannot compile haddock-2.11 with ghc-7.4.1.

You should probably have a working haddock-2.10 that came with your GHC. If not, you can either install haddock-2.10.0, or you can upgrade your GHC (recommended, there have been a couple of bugs fixed since 7.4.1).