Skip to content

Build failure with GHC 9.6.2

Hi @clint,

When building hopenpgp-tools 0.23.7 or 0.23.8 with GHC 9.6.3, the following error occurs:

[5 of 5] Compiling Main             ( hkt.hs, dist/build/hkt/hkt-tmp/Main.dyn_o )

hkt.hs:125:74: error: [GHC-39999]
    • Could not deduce ‘GHC.Base.Alternative (Either String)’
        arising from a use of ‘<|>’
      from the context: (MonadResource m, MonadThrow m)
        bound by the type signature for:
                   grabMatchingKeysConduit :: forall (m :: * -> *).
                                              (MonadResource m, MonadThrow m) =>
                                              FilePath -> Bool -> Text -> ConduitM () TK m ()
        at hkt.hs:(112,1)-(117,24)
    • In the first argument of ‘(<|>)’, namely
        ‘fmap (keyMatchesFingerprint True tk) efp
           <|> fmap (keyMatchesEightOctetKeyId True tk . Right) eeok’
      In the second argument of ‘($)’, namely
        ‘fmap (keyMatchesFingerprint True tk) efp
           <|> fmap (keyMatchesEightOctetKeyId True tk . Right) eeok
           <|> return (keyMatchesUIDSubString srch tk)’
      In the expression:
        either (const False) id
          $ fmap (keyMatchesFingerprint True tk) efp
              <|> fmap (keyMatchesEightOctetKeyId True tk . Right) eeok
              <|> return (keyMatchesUIDSubString srch tk)
    |
125 |       either (const False) id $ fmap (keyMatchesFingerprint True tk) efp <|>
    |                                                                          ^^^

hkt.hs:524:68: error: [GHC-39999]
    • No instance for ‘GHC.Base.Alternative (Either String)’
        arising from a use of ‘<|>’
    • In the first argument of ‘(<|>)’, namely
        ‘fmap (keyMatchesFingerprint True tk) (parseFingerprint srch)
           <|>
             fmap
               (keyMatchesEightOctetKeyId True tk . Right)
               (parseEightOctetKeyId srch)’
      In the second argument of ‘($)’, namely
        ‘fmap (keyMatchesFingerprint True tk) (parseFingerprint srch)
           <|>
             fmap
               (keyMatchesEightOctetKeyId True tk . Right)
               (parseEightOctetKeyId srch)
           <|> return (keyMatchesUIDSubString srch tk)’
      In the expression:
        either (const False) id
          $ fmap (keyMatchesFingerprint True tk) (parseFingerprint srch)
              <|>
                fmap
                  (keyMatchesEightOctetKeyId True tk . Right)
                  (parseEightOctetKeyId srch)
              <|> return (keyMatchesUIDSubString srch tk)
    |
524 |       fmap (keyMatchesFingerprint True tk) (parseFingerprint srch) <|>
    |                                                                    ^^^

This issue does not occur on GHC 9.2.8 or 9.4.8. AFAICT, there wasn't a change in the implementation of <|> in base and nothing notable in the changelog.

Do you have an idea regarding the cause or what else I could search for?

System information

OS: Arch Linux
Kernel: Linux 6.6.8.arch1-1
GHC: 9.6.3
base: 4.18.1.0
hopenpgp-tools: 0.23.7/0.23.8

Edited by Vekhir