Skip to content

cabal format update command to update list of modules #5306

Open

Description

@gbaz

The syntax is open to bikeshedding, but the idea is that cabal init auto-populates modules in a cabal file when it creates it. However, there's no way to auto-populate additional modules you may have since added.

It would be nice if we could add an update command that added to other-modules all modules in the source-dir not otherwise listed, so people didn't have to add them by hand as they added new modules to a project. We could even have a flag that controlled if they were added to exposed or other in the case of library stanzas.

Adding this as a subcommand of format makes sense imho because it uses the same round-tripping as format, and it also is blocked on public exposure by the same round-trip issues listed in : #2460

Activity

  1. 23Skidoo commented on May 7, 2018

    @23Skidoo
    Member

    Like all similar features, I think this requires comment-preserving exactprint to be implemented first.

  2. gbaz commented on May 7, 2018

    @gbaz
    CollaboratorAuthor

    Hrm. Ok, so in #2460 we have a full correct data roundtrip almost there except for one encoding issue. However, I guess that still leaves comments out. I confess I don't still know the full state of things. Are we fully on the parsec parsers now? Are there plans for a comment-preserving exactprint or any tickets describing the issue more fully. Or is there just a desire for this?

    (i guess related prior art is ghc-exactprint and also https://dorchard.wordpress.com/2017/09/20/scrap-your-reprinter/)

  3. hvr commented on May 16, 2018

    @hvr
    Member

    Are we fully on the parsec parsers now?

    For .cabal files, yes; since cabal 2.2

    for cabal.project / cabal.config not yet

    Are there plans for a comment-preserving exactprint

    Yes, definitely -- the ability to roundtrip .cabal files is essential to achieve some goals for hackage revisions! But as usual, it's a priority-scheduling / scarce resource issue... in hindsight, this could have been a great GSOC project...

    /cc @phadej

  4. fgaz commented on Mar 21, 2021

    @fgaz
    Member
  5. changed the title [-]`cabal format update` command[/-] [+]`cabal format update` command to update list of modules[/+] on Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions