changed 2 years ago
Published Linked with GitHub

Cabal meeting (17/08/2023)

Previously: https://hackmd.io/2EPSwwg8QqqZ96cFdW2wTQ

Next Release

  • Help needed with #9088.
    • If we can't get it through, we'll skip it for this backport.

Cabal exact-printing in HLS

  • HLS has a cabal plugin: https://discourse.haskell.org/t/hsoc-hls-cabal-file-support/7331/2
    • Establishing a context for completions (Value Context, Keyword Context, ) is not easily possible
    • Custom parsing that works 95% of the time is used.
    • Fitting .cabal intermediate structures would improve the code and reduce maintenance burden for HLS team.
  • Often requested feature in HLS: https://github.com/haskell/haskell-language-server/issues/3595
    • Requires parsing and modifying .cabal files without modifying the rest of the cabal file
    • GenericPackageDescription insufficient due to loss of Source Positions
    • Intermediate representations of .cabal files are unknown / hard to discover
    • Custom megaparsec parser used for POC of Code Action "Add module to exposed-modules" field.
      • FYI, this code action is working for a lot of use-cases already
    • Explicit goal of being an exactprinter
  • See megaissue (and there is a whole github project, linked to in the issue).
  • While the HLS's custom parser serves a different purpose, it'd be much nicer if we could re-use Cabal directly
  • In a dicussion, @fendor and @andreabedini talked about a way forward:
    • Let's make [Field ann] roundtripping by modifying the lexer
      • Trailing whitespace needs to be handled
      • Comments need to be handled
      • Are braces currently handled in the lexer or are they a part of ann?
      • POC branch by @andreabedini available
    • Field ann gives us enough information to implement the Code Action for HLS
    • Ideally, we also make Fields ann (note: different intermediate representation) roundtrip with [Field ann]

Pros:

  • We are relatively close to achieving roundtrips of [Field ann] <-> .cabal
  • Immense help for tooling already

Cons:

  • No field analysis, further parsing required.

Proposed roadmap:

  1. HLS releases with the Code Action using a custom parser
  2. The custom parser is replaced by [Field ann] internally, but still permitting an interface HLS can use
  3. Improve the lexer and enable roundtripping of [Field ann] <-> .cabal file
  4. Evaluate what Code Actions and IDE features can be implemented on top of that

Cabal nix integration

  • Users’ survey.
  • tl;dr: most people do not use it, with some exceptions (see message by neil.mayhew).
  • Some use stack nix integration, but I am not sure it is actually the same thing as cabal.
    (I am told it is by various stack users. ++bsa)
    Action Item: We kill it.

Other topics

  • GHC 9.8

Hécate: 3.10.2.0 release will also be shipped with GHC 9.8. It needs to be patched in order to recognise it as a legal version.

Select a repo