haskell / lsp

Haskell library for the Microsoft Language Server Protocol
364 stars 91 forks source link

lsp-types 1.4 1.5 1.6 fail to build with GHC 9.8.1: `Duplicate record field ‘_foo’ in export list` #530

Closed andreasabel closed 10 months ago

andreasabel commented 10 months ago

lsp-types-1.6.0.0 fails to build with GHC 9.8.1: Duplicate record field ‘_foo’ in export list

cabal get lsp-types-1.6.0.0
cd lsp-types-1.6.0.0
cabal build -w ghc-9.8.1
...
(tons of similar errors)
...
src/Language/LSP/Types.hs:45:5: error: [GHC-97219]
    Duplicate record field ‘_partialResultToken’ in export list:
       ‘module Language.LSP.Types.WorkspaceSymbol’ exports the field ‘_partialResultToken’
       belonging to the constructor ‘WorkspaceSymbolParams’
         imported from ‘Language.LSP.Types.WorkspaceSymbol’ at src/Language/LSP/Types.hs:92:1-51
       ‘module Language.LSP.Types.CallHierarchy’ exports the field ‘_partialResultToken’
       belonging to the constructor ‘CallHierarchyIncomingCallsParams’
         imported from ‘Language.LSP.Types.CallHierarchy’ at src/Language/LSP/Types.hs:49:1-49
       ‘module Language.LSP.Types.CallHierarchy’ exports the field ‘_partialResultToken’
       belonging to the constructor ‘CallHierarchyOutgoingCallsParams’
         imported from ‘Language.LSP.Types.CallHierarchy’ at src/Language/LSP/Types.hs:49:1-49
    Suggested fix: Perhaps you intended to use DuplicateRecordFields
   |
45 |   , module Language.LSP.Types.WorkspaceSymbol
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.8#re-exporting-clashing-record-fields-now-requires-xduplicaterecordfields

The immediate cure is to revise lsp-types-1.6.0.0 to base < 4.19: https://hackage.haskell.org/package/lsp-types-1.6.0.0/revisions/

One could consider a patch release adding DuplicateRecordFields to the default-extensions to enable building lsp-types-1.6.0.0 with GHC > 9.6.

andreasabel commented 10 months ago

Also revised lsp-types 1.4.0.1 and 1.5.0.0.

michaelpj commented 10 months ago

Thanks for the revisions. master has 9.8 in CI, so this is working for the last few releases.

One could consider a patch release adding DuplicateRecordFields to the default-extensions to enable building lsp-types-1.6.0.0 with GHC > 9.6.

Are people using old versions still? I'm mostly focussed on HLS, which pretty aggressively follows the latest lsp.

andreasabel commented 10 months ago

agda-language-server has been using lsp-1, but I will try to migrate it to lsp-2.

andreasabel commented 10 months ago

I notice lsp-types-2 has ballooned into 400 modules, how come? This makes compilation very slow.

michaelpj commented 10 months ago

lsp-types-2 is now mostly auto-generated, so it's one module per type. There's no sensible way to group them and putting everything in one module would also be pretty bad. It goes much faster when you tell GHC it can use some parallelism building the package (I await the GHC/cabal semaphore work eagerly...), e.g.

package lsp-types
  ghc-options: -j4
michaelpj commented 10 months ago

I think there isn't anything else to do here?

andreasabel commented 10 months ago

@michaelpj If you give me upload rights for lsp-types, I can make patch releases (which amounts to adding the extension to the cabal file(s)).

michaelpj commented 10 months ago

I can do that but I'm also happy to fix things. I thought we got everything - what else do you want to do?

andreasabel commented 10 months ago

What I meant was making lsp-1 available on GHC 9.8:

One could consider a patch release adding DuplicateRecordFields to the default-extensions to enable building lsp-types-1.6.0.0 with GHC > 9.6.

michaelpj commented 10 months ago

Sure, if you'd like to maintain old releases I'm happy for you to do that. I'll give you write permissions on the repo too, please do make sure there are tags for any releases that you do.

michaelpj commented 10 months ago

Ah, I see you already have it via the haskell org!

michaelpj commented 10 months ago

Added you on Hackage