Skip to content

Old Cabals fail to build with GHC 9.0.1

Summary

I maintain a library, cabal-helper, that tries to help with getting GHC API sessions up and running in an arbitrary cabal project. So far old Cabals always built with newer GHC releases modulo a revision update on Hackage to allow the newer base but this seems to no longer be true for the GHC 9.0.1 release.

I'm not quite sure if this should be a Cabal or GHC issue, is this build failure expected from GHC's side?

Steps to reproduce

$ cabal get Cabal-3.2.0.0
$ cd Cabal-3.2.0.0
$ cabal build --allow-newer=base -w ghc-9.0.1
Distribution/Utils/Generic.hs:260:38: error:
    • Couldn't match type: IO a
                     with: ghc-prim-0.7.0:GHC.Types.IO a
      Expected: String -> ghc-prim-0.7.0:GHC.Types.IO a
        Actual: String -> IO a
    • In the first argument of ‘(.)’, namely ‘action’
      In the second argument of ‘(>>=)’, namely
        ‘action . ignoreBOM . fromUTF8LBS’
      In the expression:
        BS.hGetContents hnd >>= action . ignoreBOM . fromUTF8LBS
    • Relevant bindings include
        action :: String -> IO a
          (bound at Distribution/Utils/Generic.hs:258:27)
        withUTF8FileContents :: FilePath -> (String -> IO a) -> IO a
          (bound at Distribution/Utils/Generic.hs:258:1)
    |
260 |     (\hnd -> BS.hGetContents hnd >>= action . ignoreBOM . fromUTF8LBS)
    |  
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information