haskellcabalhakyll

cabal new-install hakyll is fails to build dependency


After installing ghcup, I try to install hakyll with the command cabal new-install hakyll. This leads to a build error in a dependency, the text-conversions library:

Failed to build text-conversions-0.3.0.
Build log (
/home/me/.cabal/logs/ghc-8.8.4/text-conversions-0.3.0-e3c3dbd414a885ff0e8ec81ad4c2c319c5dff5772ce6392ac561833941ecfd06.log
):
Configuring library for text-conversions-0.3.0..
Preprocessing library for text-conversions-0.3.0..
Building library for text-conversions-0.3.0..
[1 of 1] Compiling Data.Text.Conversions ( src/Data/Text/Conversions.hs, dist/build/Data/Text/Conversions.o )

src/Data/Text/Conversions.hs:152:5: error:
    • Couldn't match expected type ‘Either String B.ByteString’
                  with actual type ‘(B.ByteString, [Char])’
    • In the pattern: (bs, "")
      In a case alternative: (bs, "") -> Just $ Base16 bs
      In the expression:
        case Base16.decode (T.encodeUtf8 txt) of
          (bs, "") -> Just $ Base16 bs
          (_, _) -> Nothing
    |
152 |     (bs, "") -> Just $ Base16 bs
    |     ^^^^^^^^

src/Data/Text/Conversions.hs:153:5: error:
    • Couldn't match expected type ‘Either String B.ByteString’
                  with actual type ‘(a1, b1)’
    • In the pattern: (_, _)
      In a case alternative: (_, _) -> Nothing
      In the expression:
        case Base16.decode (T.encodeUtf8 txt) of
          (bs, "") -> Just $ Base16 bs
          (_, _) -> Nothing
    |
153 |     (_,  _)  -> Nothing
    |     ^^^^^^^

src/Data/Text/Conversions.hs:164:5: error:
    • Couldn't match expected type ‘Either String BL.ByteString’
                  with actual type ‘(BL.ByteString, [Char])’
    • In the pattern: (bs, "")
      In a case alternative: (bs, "") -> Just $ Base16 bs
      In the expression:
        case Base16L.decode (TL.encodeUtf8 $ TL.fromStrict txt) of
          (bs, "") -> Just $ Base16 bs
          (_, _) -> Nothing
    |
164 |     (bs, "") -> Just $ Base16 bs
    |     ^^^^^^^^

src/Data/Text/Conversions.hs:165:5: error:
    • Couldn't match expected type ‘Either String BL.ByteString’
                  with actual type ‘(a0, b0)’
    • In the pattern: (_, _)
      In a case alternative: (_, _) -> Nothing
      In the expression:
        case Base16L.decode (TL.encodeUtf8 $ TL.fromStrict txt) of
          (bs, "") -> Just $ Base16 bs
          (_, _) -> Nothing
    |
165 |     (_,  _)  -> Nothing
    |     ^^^^^^^
cabal: Failed to build text-conversions-0.3.0 (which is required by
exe:hakyll-init from hakyll-4.13.4.0). See the build log above for details.

Any idea what is going wrong and how to fix it?


Solution

  • The text-conversions package is incompatible with the newest version of base16-bytestring that was released this week. So the build fails.

    A short-term solution is to add a constraint, using the flag --constraint="base16-bytestring < 1" in the cabal install command, or adding the line constraints: base16-bytestring < 1 to the file ~/.cabal/config. (Link to relevant section of the cabal documentation)

    On the long term, the text-conversions package must be fixed to add a version upper bound on a dependency base16-bytestring < 1. You can ask about the status of things in the following issues:

    Ideally (not necessarily), a new version of text-conversions compatible with base16-bytestring-1.0.0.0 should be released, but it is still necessary to fix the bounds of existing versions to avoid ever picking up broken build plans.