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

fix ghc-9.7 compilation errors #106

Closed

Conversation

shayne-fletcher
Copy link

i happened to try building with ghc built from head today (ghc.9.7.20230617) and found it failed with some ambiguities. this seems to fix it. tested with cabal new-build all

ndmitchell added a commit that referenced this pull request Jul 1, 2023
ndmitchell added a commit that referenced this pull request Jul 1, 2023
@ndmitchell
Copy link
Owner

Thanks for the PR! I applied some of this in 5447cd1 and an alternative to other parts in 173409f. Does that all work for you now?

@shayne-fletcher
Copy link
Author

nearly. the unsnoc problem remains.

extra               > /private/var/folders/rj/q93vlym52875_k7nwz_c3wth0000gn/T/stack-19d020feeadbf370/extra-1.7.13/src/Data/List/Extra.hs:202:24: error: [GHC-87543]
extra               >     Ambiguous occurrence ‘unsnoc’.
extra               >     It could refer to
extra               >        either ‘Data.List.unsnoc’,
extra               >               imported from ‘Data.List’ at src/Data/List/Extra.hs:41:1-16
extra               >               (and originally defined in ‘GHC.List’),
extra               >            or ‘Data.List.Extra.unsnoc’,
extra               >               defined at src/Data/List/Extra.hs:199:1.
extra               >     |        
extra               > 202 |     where Just (a,b) = unsnoc xs
extra               >     |                        ^^^^^^

@ndmitchell
Copy link
Owner

Oops. Put the conditions in backwards. Can you try again?

@shayne-fletcher
Copy link
Author

looks good, builds now. there are warnings. confirmed that adding {-# OPTIONS_GHC -Wno-duplicate-exports -Wno-x-partial #-} to the top of 'Data.List.Extra.hs' suppresses them.

src/Data/List/Extra.hs:21:23: warning: [GHC-47854] [-Wduplicate-exports]
    ‘!?’ is exported by ‘(!?)’ and ‘module Data.List’
   |
21 |     headDef, lastDef, (!?), notNull, list, unsnoc, cons, snoc,
   |                       ^^^^

src/Data/List/Extra.hs:21:44: warning: [GHC-47854] [-Wduplicate-exports]
    ‘unsnoc’ is exported by ‘unsnoc’ and ‘module Data.List’
   |
21 |     headDef, lastDef, (!?), notNull, list, unsnoc, cons, snoc,
   |                                            ^^^^^^

src/Data/List/Extra.hs:498:31: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
498 | groupSort = map (\x -> (fst $ head x, map snd x)) . groupOn fst . sortOn fst
    |                               ^^^^

@shayne-fletcher
Copy link
Author

fixed by a stack starting at 5447cd1

@shayne-fletcher shayne-fletcher deleted the fix-ambiguities branch July 1, 2023 18:34
@ndmitchell
Copy link
Owner

Thanks! Just releasing a new extra now

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

Successfully merging this pull request may close these issues.

2 participants