8000 Allow duplicate fields · Issue #572 · sol/hpack · GitHub
[go: up one dir, main page]

Skip to content

Allow duplicate fields #572

Open
Open

Description

@MrQubo

Cabal supports duplicate fields in stanzas, hpack should as well.

Activity

  1. MrQubo commented on Dec 16, 2023

    @MrQubo
    Author

    The main problem to overcome is that YAML explicitly disallows duplicate fields. I can see two solutions.

    1. Stop using YAML and use YAML-like but with duplicate fields allowed. This can be implemented without writing own parser by using libyaml package.
    2. Use some valid YAML syntax for this feature, e.g.
      executables:
        example:
          - main: Main.hs
          - source-dirs: src
          - ghc-options: -O2
          - ghc-options: -Wall

    The second solution feels a bit hacky, and I think the first one is better.

  2. MrQubo commented on Dec 16, 2023

    @MrQubo
    Author

    My use case is that with YAML's anchors it's not possible to merge lists (e.g. ghc-options). With duplicate fields I could do:

    executables:
      example:
        main: Main.hs
        source-dirs: src
        ghc-options: *ghc-options-opt
        ghc-options: *ghc-options-warn

    There are other solutions to my particular problem, but in my opinion, hpack should stick to be close to cabal whenever possible, as this results in less confusion for haskell developers, hence this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0