Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHC 9.10: Pattern match has inaccessible right hand side #486

Open
locallycompact opened this issue Mar 6, 2024 · 10 comments
Open

GHC 9.10: Pattern match has inaccessible right hand side #486

locallycompact opened this issue Mar 6, 2024 · 10 comments

Comments

@locallycompact
Copy link
Contributor

       > src/Polysemy/Internal/Union.hs:298:1: warning: [8;;https://errors.haskell.org/messages/GHC-94210GHC-942108;;] [-Woverlapping-patterns]
       >     Pattern match has inaccessible right hand side
       >     In an equation for ‘absurdU’: absurdU (Union _ _) = ...
       >     |
       > 298 | absurdU (Union _ _) = error "Unsafe use of UnsafeMkElemOf"

https://gitlab.horizon-haskell.net/package-sets/horizon-advance/-/jobs/1417118#L185

@m4dc4p
Copy link

m4dc4p commented May 23, 2024

I also see errors related to TH changes:

[17 of 44] Compiling Polysemy.Internal.TH.Effect ( src/Polysemy/Internal/TH/Effect.hs, dist/build/Polysemy/Internal/TH/Effect.o, dist/build/Polysemy/Internal/TH/Effect.dyn_o )
src/Polysemy/Internal/TH/Effect.hs:140:28: error: [8;;https://errors.haskell.org/messages/GHC-83865GHC-838658;;]
    • Couldn't match type ‘Name -> Dec’ with ‘Dec’
      Expected: Fixity -> NamespaceSpecifier -> Dec
        Actual: Fixity -> NamespaceSpecifier -> Name -> Dec
    • Probable cause: ‘InfixD’ is applied to too few arguments
      In the first argument of ‘flip’, namely ‘InfixD’
      In the second argument of ‘(.)’, namely
        ‘flip InfixD (cliFunName cli)’
      In the second argument of ‘maybe’, namely
        ‘(pure . flip InfixD (cliFunName cli))’
    |
140 |   =  maybe [] (pure . flip InfixD (cliFunName cli)) (cliFunFixity cli)
    |                            ^^^^^^

@m4dc4p
Copy link

m4dc4p commented May 24, 2024

The fix for the error above is really simple:

diff --git a/vendor/polysemy/src/Polysemy/Internal/TH/Effect.hs b/vendor/polysemy/src/Polysemy/Internal/TH/Effect.hs
index c4df68da3..bb8051326 100644
--- a/vendor/polysemy/src/Polysemy/Internal/TH/Effect.hs
+++ b/vendor/polysemy/src/Polysemy/Internal/TH/Effect.hs
@@ -137,7 +137,11 @@ genFreer should_mk_sigs type_name = do
 -- its body on effect's data constructor.
 genSig :: ConLiftInfo -> [Dec]
 genSig cli
-  =  maybe [] (pure . flip InfixD (cliFunName cli)) (cliFunFixity cli)
+#if __GLASGOW_HASKELL__ >= 910
+  =  maybe [] (\fixity -> pure $ InfixD fixity NoNamespaceSpecifier (cliFunName cli)) (cliFunFixity cli)
+#else
+  =  maybe [] (\fixity -> pure $ InfixD fixity (cliFunName cli)) (cliFunFixity cli)
+#endif
   ++ [ SigD (cliFunName cli) $ quantifyType
        $ ForallT [] (member_cxt : cliFunCxt cli)
        $ foldArrowTs sem

I didn't look into the warning, but that will get the library compiling at least.

@tek
Copy link
Member

tek commented May 25, 2024

I think that warning has always been there, hasn't it? Gotta research which GHC versions need that match.

Anyway, I added the TH fix, but I don't have 9.10 available, so someone's gotta test this.

@locallycompact
Copy link
Contributor Author

You can get a 9.10.1 shell for polysemy directly from horizon by doing:

nix develop 'git
+https://gitlab.horizon-haskell.net/package-sets/horizon-advance#polysemy.env'

Run ghc-pkg list to see what it pulled.

@tek
Copy link
Member

tek commented May 25, 2024

thanks. I'm getting

conflict: ghc-tcplugins-extra => ghc>=7.10 && <9.10

although I saw that there's a patch in the repo that's supposed to jailbreak this

@tek
Copy link
Member

tek commented May 25, 2024

added some CPP for the warning as well

@m4dc4p
Copy link

m4dc4p commented Jun 3, 2024

I would be happy to test but I can't tell what branch or commit I should use. I don't see a linked PR ...

@tek
Copy link
Member

tek commented Jun 3, 2024

@m4dc4p it's in master

@m4dc4p
Copy link

m4dc4p commented Jun 3, 2024

Can confirm this builds with 9.10.1!

@tek
Copy link
Member

tek commented Jun 3, 2024

alright, uploaded a release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants