Skip to content

Conversation

@mpilgrem
Copy link
Collaborator

@mpilgrem mpilgrem changed the title Fix #604 When applicable, use elif in Cabal files Fix #604 Where applicable, use elif in Cabal files Mar 11, 2025
Copy link
Owner

@sol sol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole HasEmpty construction is not particularly beautiful.

I think what I would try is either

  • try to transform nested conditionals into elifs at parsing time

or instead

  • focus on some general solution to avoid staircases in package.yaml (as we started discussing in #604)

(or maybe even do both)

else
hs-source-dirs:
unsupported-os
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this is relevant user documentation. Nested if-statements and elif are semantically equivalent. As I understand it, this is a purely cosmetic change.

I say, either remove this completely, or add a separate section that describes how .cabal files are formatted. This section could then also include what I mentioned here: #606 (comment)

uses "RebindableSyntax"
&& (uses "OverloadedStrings" || uses "OverloadedLists")
&& pathsModule `elem` getMentionedModules sect)
, makeVersion [2,2] <$ guard (sectionSatisfies (isJust . maybeSectionAConditional) sect)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this is saying is that if a nested conditional can be transformed into an elif, then require Cabal 2.2.

What I think you would want to do is the other way around: If the rendered .cabal file has cabal-version: 2.2 (or later) then produce elifs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants