Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overwriting the version with a .version file #231

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

dasJ
Copy link
Member

@dasJ dasJ commented Aug 7, 2024

Copy link

github-actions bot commented Aug 7, 2024

Nixpkgs diff

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

Looking good, thanks!

main/Main.hs Outdated
versionFromFile :: String
versionFromFile = case $(embedFileIfExists ".version") of
Just ver -> unpack ver
_ -> showVersion version
Copy link
Member

Choose a reason for hiding this comment

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

Although, hold on, there's a spurious warning when compiling:

main/Main.hs:54:3: warning: [-Woverlapping-patterns]
    Pattern match is redundant
    In a case alternative: Just ver -> ...
   |
54 |   Just ver -> unpack ver
   |   ^^^^^^^^^^^^^^^^^^^^^^

Investigating..

Copy link
Member

Choose a reason for hiding this comment

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

Fixed with c37f999

To avoid this warning:

    main/Main.hs:54:3: warning: [-Woverlapping-patterns]
        Pattern match is redundant
        In a case alternative: Just ver -> ...
       |
    54 |   Just ver -> unpack ver
       |   ^^^^^^^^^^^^^^^^^^^^^^

Which happens because to the compiler, the Template Haskell expression
looks like a constant, always making one pattern redundant.

It won't dig into that if we use a function on it though :)
@infinisil infinisil merged commit 7dfd3f0 into master Aug 7, 2024
2 checks passed
@infinisil infinisil deleted the feat/version-file branch August 7, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants