haskell/primitive

primitive doesn't compile with ghc 9.0 rc1 unless you add --allow-new

GeorgeCo opened this issue · 21 comments

Hi

I know this is just 9.0 alpha but primitive does't compile unless you add --allow-new. Can you release a new version that will install with ghc 9.0. A lot of packages depend on primitive.

Thanks
George

It seems to build if we bump the upper bound of base, I created a pull request for that here: #297

I can't yet build the test suite and in fact trying to leads to this weird error message from cabal:

> cabal build test-qc --with-compiler=ghc-9.0.0.20200925 
'ghc' version < 8.12): /usr/local/bin/ghc-9.0.0.20200925 is version
9.0.0.20200925
Resolving dependencies...
cabal: Cannot build the test suite 'test-qc' because the solver did not find a
plan that included the test suites for primitive-0.7.1.0. It is probably worth
trying again with test suites explicitly enabled in the configuration in the
cabal.project{.local} file. This will ask the solver to find a plan with the
test suites available. It will either fail with an explanation or find a
different plan that uses different versions of some other packages. Use the
'--dry-run' flag to see package versions and check that you are happy with the
choices.

I don't know if that is expected.

If I had to guess, one of the dependencies of test-qc test suite has an upper bound on base, which prevents it from building. PVP and overly restrictive bounds at its finest. ;P
@GeorgeCo if you are up to it try checking if there are more packages that has an upper bound on base

Aside from the test suite issue, is the only problem just that

base >= 4.5 && < 4.15

needs to be

base >= 4.5 && < 4.16

I can change that and do a hackage revision if that's the case.

bump on this

Can anyone confirm that the hackage revision I suggested is sufficient? If so, I can make that change.

The issue is still true with 9.0 rc1

Can someone confirm that the revision I suggested in #296 (comment) is correct? If so, I can make that revision on hackage.

l29ah commented

I got plenty of spooky type errors after adjusting for base dep, like this one:

Data/Primitive/Types.hs:273:264: error:
    • Couldn't match expected type ‘Word8#’ with actual type ‘Word#’
    • In the first argument of ‘W8#’, namely
        ‘(indexWord8Array# arr# i#)’
      In the expression: W8# (indexWord8Array# arr# i#)
      In an equation for ‘indexByteArray#’:
          indexByteArray# arr# i# = W8# (indexWord8Array# arr# i#)
    |
273 | derivePrim(Word8, W8#, sIZEOF_WORD8, aLIGNMENT_WORD8,

Oh nice, looks like finally sized Int/Word have been properly implemented in GHC: https://gitlab.haskell.org/ghc/ghc/-/commit/be5d74caab64abf9d986fc7290f62731db7e73e7

This means we'll need a some work in primitive to make it work with GHC-9.0, but it is good and long anticipated change. All it should take is some fixes to Prim instances with CPP

I'll see if I can bring the CPP up to date.

Oh nice, looks like finally sized Int/Word have been properly implemented in GHC: https://gitlab.haskell.org/ghc/ghc/-/commit/be5d74caab64abf9d986fc7290f62731db7e73e7

I believe sized Int / Word have been reverted from GHC 9.0. I can compile primitive with GHC 9.0.1 RC1 without a hitch.

@Bodigrim Thank you for confiriming this. I am not sure if it was reverted or not, but I can confirm too that ghc-9.0-rc1 does not include this change, it is in GHC HEAD however, which means we don't have to deal with this issue right now.

@l29ah Are you sure you were building primitive with ghc-9.0 and not ghc HEAD instead?

l29ah commented
asr commented

Blocking agda/agda#4955.

Yeah, primitive-0.7.1.0 could just get a revision to support GHC 9.0.1

yes, now that ghc 9.0.1 is out it would be great if this could get out asap as many packages won't be available until this is out.

I've confirmed that ghc-9.0.1 can build primitive-0.7.1.0, and pushed a bounds revision to hackage, so after cabal update, this is should be fine.

Also, there's a separate issue with GHC HEAD that was reported in the middle of this thread that is unrelated, but important. I'm going to close this issue since the originally reported issue has been resolved, and I'll open another issue to track the problem with GHC HEAD.