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

Remove renderEra. Rename prettyTo* to docTo* functions #387

Merged
merged 1 commit into from Nov 28, 2023

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Nov 27, 2023

Changelog

- description: |
    - Remove `renderEra` Use `docToText . pretty` instead.
    - Rename `prettyTo*` functions to `docTo*`
# 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
   - improvement    # QoL changes e.g. refactoring
  # - 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

This PR introduces consistency in prettyprinting functions naming and simplifies rendering of names of eras.

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

@carbolymer carbolymer changed the title Remove `rende Remove renderEra. Rename prettyTo* to docTo* functions Nov 27, 2023
@carbolymer carbolymer force-pushed the mgalazyn/refactor/remove-renderera branch from 4a2e6de to da98674 Compare November 27, 2023 15:55
@@ -30,14 +30,14 @@ import Prettyprinter.Render.Terminal
-- of colored output. This is a type alias for AnsiStyle.
type Ann = AnsiStyle

prettyToString :: Doc AnsiStyle -> String
prettyToString = show
docToString :: Doc AnsiStyle -> String
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those functions weren't accepting Pretty a => a but Doc so their names were misleading and it was resulting in oddities like: prettyToString . pretty

@@ -242,16 +244,11 @@ deriving instance Eq (CardanoEra era)
deriving instance Ord (CardanoEra era)
deriving instance Show (CardanoEra era)

deriving via (ShowOf (CardanoEra era)) instance Pretty (CardanoEra era)
instance Pretty (CardanoEra era) where
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now Pretty instance does not print Era suffix which makes it suitable to use in console logging and error messages building.

@carbolymer carbolymer force-pushed the mgalazyn/refactor/remove-renderera branch from b8593f0 to f279a06 Compare November 27, 2023 17:24
@carbolymer carbolymer added this pull request to the merge queue Nov 28, 2023
Merged via the queue into main with commit ef538ca Nov 28, 2023
20 checks passed
@carbolymer carbolymer deleted the mgalazyn/refactor/remove-renderera branch November 28, 2023 13:02
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.

None yet

3 participants