Skip to content

Conversation

@newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Apr 18, 2025

Changelog

- description: |
    Use `Vary` for key output format
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

Progression towards input-output-hk/cardano-node-wiki#72

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@newhoggy newhoggy force-pushed the newhoggy/use-var-for-key-output branch 5 times, most recently from 056cbe2 to 2e538ba Compare April 20, 2025 08:19
@newhoggy
Copy link
Contributor Author

Addresses: #566

@newhoggy newhoggy requested a review from a team April 21, 2025 01:29
@newhoggy newhoggy requested a review from a team as a code owner April 21, 2025 01:29
import Data.Text.IO qualified as Text

import Vary (Vary)
import Vary qualified
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add grouping of this import with other hackage packages in fourmolu.yaml? A standalone import group looks odd.

Btw. I think author should've chosen more conventional module name like Data.Vary or something.

keyOutputFormat
& ( id
. Vary.on
( \FormatBech32 ->
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if in the next step we could refactor out duplicated rendering of each of the formats

, Opt.help $
mconcat
[ "Optional key output format. Accepted output formats are \"text-envelope\" "
, "and \"bech32\" (deprecated)."
Copy link
Contributor

Choose a reason for hiding this comment

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

Why bech32 is deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bech32 isn't deprecated. The --key-output-format switch is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, the phrasing was slightly confusing. Maybe it should say "deprecated flag" or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed up the message to be more clear.

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

alternatives fs <|> defaults fs
parserFromFlags :: Parser a -> (Flag a -> String) -> [Flag a] -> Parser a
parserFromFlags p mkHelp fs =
alternatives fs <|> p <|> defaults fs
Copy link
Contributor

@Jimbo4350 Jimbo4350 Apr 22, 2025

Choose a reason for hiding this comment

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

p appears to be an actual parser (not empty) in pKeyOutputFormat. We should deprecate pKeyOutputFormat and remove p in the future.

Edit: I see you've already done that 👍

@newhoggy newhoggy force-pushed the newhoggy/use-var-for-key-output branch from 138be17 to 802dbf3 Compare April 23, 2025 12:59
@newhoggy newhoggy requested a review from carbolymer April 23, 2025 13:06
@newhoggy newhoggy force-pushed the newhoggy/use-var-for-key-output branch from 802dbf3 to 5a513b7 Compare April 23, 2025 14:25
Copy link
Contributor

@carbolymer carbolymer left a comment

Choose a reason for hiding this comment

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

LGTM. Could you update changelog entry with the information about the flag changes?

@newhoggy newhoggy force-pushed the newhoggy/use-var-for-key-output branch 3 times, most recently from 067e362 to 267e2ca Compare May 1, 2025 13:17
@newhoggy newhoggy force-pushed the newhoggy/use-var-for-key-output branch 2 times, most recently from 0076698 to d239164 Compare May 1, 2025 13:41
@newhoggy newhoggy mentioned this pull request May 1, 2025
3 tasks
@newhoggy newhoggy added this pull request to the merge queue May 1, 2025
Merged via the queue into master with commit 886b444 May 1, 2025
46 checks passed
@newhoggy newhoggy deleted the newhoggy/use-var-for-key-output branch May 1, 2025 14:15
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.

4 participants