You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@sol, this does, de facto, only affect the readability of generated Cabal files. However, I think that is not unimportant: an important purpose of Cabal files is to be read by people and not all Hpack users include package.yaml in published packages.
I did not track down much history to the introduction of elif:
in a discussion on multiway flags (that went nowhere), somebody observed "We should really add some elif sugar to Cabal 2.0 IMO to avoid those staircase if/else we currently have to endure..."; and
Would you limit the use of conditions as YAML keys to the if...elif..elif...else pattern? Or would you extend that to the if...if...if...if pattern? (With the presence or absence of a final - otherwise: being the toggle?)
EDIT: One advantage of the existing 'conditions as values' is that YAML syntax highlighting helps out in identfying separately the conditions.
Activity
Fix #604 When applicable, use `elif` in Cabal files
Fix #604 Where applicable, use `elif` in Cabal files
[-]When applicable, use `elif` in Cabal files[/-][+]Where applicable, use `elif` in Cabal files[/+]sol commentedon Mar 12, 2025
@mpilgrem this is a purely cosmetic change, right? Or does this enable any new use cases?
mpilgrem commentedon Mar 12, 2025
@sol, this does, de facto, only affect the readability of generated Cabal files. However, I think that is not unimportant: an important purpose of Cabal files is to be read by people and not all Hpack users include
package.yamlin published packages.I did not track down much history to the introduction of
elif:elifsugar to Cabal 2.0 IMO to avoid those staircase if/else we currently have to endure..."; andelifwas added a year later (Elif haskell/cabal#4750)mpilgrem commentedon Mar 12, 2025
(A related but distinct question is: could the Hpack format itself avoid a 'staircase'? Maybe something like:
)
sol commentedon Mar 12, 2025
Maybe even
Just floating around ideas.
mpilgrem commentedon Mar 12, 2025
The use of the conditions directly as YAML keys is interesting, but a YAML dictionary is not ordered - I assume you had in mind a list:
Would you limit the use of conditions as YAML keys to the if...elif..elif...else pattern? Or would you extend that to the if...if...if...if pattern? (With the presence or absence of a final
- otherwise:being the toggle?)EDIT: One advantage of the existing 'conditions as values' is that YAML syntax highlighting helps out in identfying separately the conditions.
Fix #604 Where applicable, use `elif` in Cabal files
Fix #604 Where applicable, use `elif` in Cabal files