1

I tried to install haddock-api-2.24.0 package with cabal (on archlinux) but it failed:

➜  ~ cabal install haddock-api-2.24.0
Resolving dependencies...
Build profile: -w ghc-8.10.4 -O1
In order, the following will be built (use -v for more details):
 - haddock-api-2.24.0 (lib) (requires build)
Starting     haddock-api-2.24.0 (lib)
Building     haddock-api-2.24.0 (lib)

Failed to build haddock-api-2.24.0.
Build log (
/home/kaga/.cabal/logs/ghc-8.10.4/haddock-api-2.24.0-385d0485d7052616aeee1dc25445b810e8e57ae43c803a5d5b3e62f2da8892e0.log
):

......

[11 of 40] Compiling Haddock.GhcUtils ( src/Haddock/GhcUtils.hs, dist/build/Haddock/GhcUtils.o, dist/build/Haddock/GhcUtils.dyn_o )

src/Haddock/GhcUtils.hs:60:42: error:
    • Could not deduce: p ~ GhcPass p0
      from the context: (SrcSpanLess (LPat p) ~ Pat p,
                         HasSrcSpan (LPat p))
        bound by the type signature for:
                   getMainDeclBinder :: forall p.
                                        (SrcSpanLess (LPat p) ~ Pat p, HasSrcSpan (LPat p)) =>
                                        HsDecl p -> [IdP p]
        at src/Haddock/GhcUtils.hs:(58,1)-(59,40)
      ‘p’ is a rigid type variable bound by
        the type signature for:
          getMainDeclBinder :: forall p.
                               (SrcSpanLess (LPat p) ~ Pat p, HasSrcSpan (LPat p)) =>
                               HsDecl p -> [IdP p]
        at src/Haddock/GhcUtils.hs:(58,1)-(59,40)
      Expected type: TyClDecl (GhcPass p0)
        Actual type: TyClDecl p
    • In the first argument of ‘tcdName’, namely ‘d’
      In the expression: tcdName d
      In the expression: [tcdName d]
    • Relevant bindings include
        d :: TyClDecl p (bound at src/Haddock/GhcUtils.hs:60:28)
        getMainDeclBinder :: HsDecl p -> [IdP p]
          (bound at src/Haddock/GhcUtils.hs:60:1)
   |
60 | getMainDeclBinder (TyClD _ d) = [tcdName d]
   |                                          ^

I've just begun to learn Haskell so I don't know what's going on here...

It seems like some serious error. What should I do to get it fixed?

Y.F.
  • 23
  • 3
  • Nice catch! I can reproduce this. I think this version of `haddock-api` is incompatible with GHC 8.10.4, so its dependency on the `ghc` library needs to be constrained more tightly. This seems worth reporting on haddock's issue tracker. `haddock-api-2.24.1` actually seems to be compatible with GHC 8.10.4. – sjakobi Mar 08 '21 at 11:36
  • 1
    @sjakobi 2.24.1 did work. But what I actually need is `hsdev`, and now there's a new problem: with `haddock-api-2.24.1` installed, `cabal install hsdev-0.3.4.0` STILL gives a list of dependencies which includes `haddock-api-2.24.0` ... That confuses me because "hackage.haskell.org" says `hsdev-0.3.4.0` requires `haddock-api (>=2.17 && <2.19 || >=2.20)`. Since I've already installed 2.24.1, why would 2.24.0 still be in the 'will be built'-list for hsdev? – Y.F. Mar 09 '21 at 07:57
  • I'm afraid I'm don't know! `cabal install` does accept additional constraints that you can use to select preferred versions though: `cabal install hsdev -w ghc-8.10.4 --constraint 'haddock-api >= 2.24.1'`. – sjakobi Mar 09 '21 at 14:14
  • @sjakobi Funny things happened! At first I tried `cabal install hdocs --constraint 'haddock-api >= 2.24.1'` (because hdocs is in the depen-list for hsdev and also requires haddock-api), but cabal failed to resolve dependencies: `haddock-api-2.24.1` requires `haddock-library >= 1.10` but `hdocs-0.5.5.0` requires `haddock-library < 1.10`!!! Felt like DOOM! So I just tried (with little hope) `cabal install hsdev --constraint 'haddock-api >= 2.24.1'`, and it WORKED?! Seems like cabal installed `hsdev` WITHOUT `hdocs`... – Y.F. Mar 10 '21 at 05:17
  • `hdocs` is only a dependency when the `hsdev`'s `docs` flag is enabled. See http://hackage.haskell.org/package/hsdev-0.3.4.0/dependencies. Since this is (surprisingly) an automatic flag, `cabal` apparently disabled it. – sjakobi Mar 10 '21 at 09:57
  • @sjakobi Oh I see! Thanks A LOOOOOT! – Y.F. Mar 10 '21 at 14:17

0 Answers0