windowshaskellcabalcabal-installeuterpea

Issue while Haskell instaling Euterpea's dependency, HCodecs did not skip version check for a later version installed


While I was installing Euterpea today, I found HCodecs-0.5.1 (a dependency for Euterpea) was tend to always to beult-fail

So I go to Hackage.Haskell.org, checked that HCodecs offers a latest version: HCodecs-0.5.2, and I installed it successfully by cabal v1-install (strictly followed the instruction from Euterpea.com & Haskell.org)

However, after I installed the HCodecs-0.5.2, the install of Euterpea still failed in installing the HCodecs-0.5.1; Which id quite weird for the dependency check did not skip the older version package for a later one available locally;

Here is the log of 2 installation, hoping anyone could give me a help on either bypass the version check, or solve the HCodecs-0.5.1's build fail:

=================Install of HCodecs-0.5.2==========================


PS C:\WINDOWS\system32> cabal v1-install HCodecs-0.5.2
Resolving dependencies...
Downloading  fail-4.9.0.0
Downloaded   fail-4.9.0.0
Starting     fail-4.9.0.0
Building     fail-4.9.0.0
Completed    fail-4.9.0.0
Downloading  HCodecs-0.5.2
Downloaded   HCodecs-0.5.2
Starting     HCodecs-0.5.2
Building     HCodecs-0.5.2
Completed    HCodecs-0.5.2

===continue install Euterpea, HCodecs-0.5.1 did not skip and fail again ====

PS C:\WINDOWS\system32> cabal v1-install Euterpea
Resolving dependencies...
Starting     HCodecs-0.5.1
Building     HCodecs-0.5.1
Failed to install HCodecs-0.5.1
Build log ( C:\Users\12798\AppData\Roaming\cabal\logs\ghc-8.10.2\HCodecs-0.5.1-KovArVTnpFnLaEvHYYD8GP.log ):
Preprocessing library for HCodecs-0.5.1..
Building library for HCodecs-0.5.1..
[1 of 7] Compiling Codec.ByteString.Builder ( src\Codec\ByteString\Builder.hs, 
dist\build\Codec\ByteString\Builder.o )
src\Codec\ByteString\Builder.hs:79:1: warning: [-Wunused-imports]
    The import of `Data.Semigroup' is redundant
      except perhaps to import instances from `Data.Semigroup'
    To import instances alone, use: import Data.Semigroup()
   |
79 | import Data.Semigroup
   | ^^^^^^^^^^^^^^^^^^^^^
[2 of 7] Compiling Codec.ByteString.Parser ( src\Codec\ByteString\Parser.hs, dist\build\Codec\ByteString\Parser.o )
src\Codec\ByteString\Parser.hs:143:5: error:
    `fail' is not a (visible) method of class `Monad'
    |
143 |     fail  err  = Parser $ \(S _ _ bytes) ->
    |     ^^^^
cabal: Leaving directory 'C:\Users\12798\AppData\Local\Temp\cabal-tmp-13328\HCodecs-0.5.1'
cabal.exe: Error: some packages failed to install:
Euterpea-2.0.7-16Dwojok2ejBacdiDIytTu depends on Euterpea-2.0.7 which failed
to install.
HCodecs-0.5.1-KovArVTnpFnLaEvHYYD8GP failed during the building phase. The
exception was:
ExitFailure 1

That's the whole log I have for issue on dependency's version


Solution

  • The problem is that Euterpea has a dependency on exactly version 0.5.1 of HCodecs, and support for the MonadFail Proposal (fully implemented as of GHC 8.8.1) was only added to HCodecs in version 0.5.2. Until Euterpea updates its dependency list, you have two choices to work around this: either pass the --allow-newer command line flag to cabal, which will cause it to ignore upper version bounds, or downgrade your GHC to 8.6.5, the final version that didn't fully implement the MonadFail Proposal. In this case, I recommend the former.

    EDIT: On June 17th, 2022, a Hackage metadata revision for Euterpea was published to correct this issue.