Skip to content

Conversation

@Princevicks-Technologies

… modernize sorting

✅ Pull Request: Improve Error Handling, Safety & Readability Summary

This pull request improves the stability, safety, and readability of the PIR tool without changing its core functionality.

Changes Made

Replaced unsafe pattern matches on Program with safe bindings.

Replaced raw error calls with friendly error messages + exitFailure.

Improved readability in retention analysis and name table generation.

Updated sorting using Down for cleaner intent.

Added simple CLI messages for better user feedback.

Added comments explaining intentional orphan instances.

Removed minor redundancies and improved formatting.

Why This Matters

These changes:

Prevent sudden crashes caused by pattern-match failures

Make CLI errors easier to understand

Improve maintainability

Do not change logic or output format

No Functional Behavior Changed

This PR is safe, review-friendly, and strictly improves code quality.

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Changelog fragments have been written (if appropriate)
    • Relevant tickets are mentioned in commit messages
    • Formatting, PNG optimization, etc. are updated
  • PR
    • (For external contributions) Corresponding issue exists and is linked in the description
    • Targeting master unless this is a cherry-pick backport
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

… modernize sorting

✅ Pull Request: Improve Error Handling, Safety & Readability
Summary

This pull request improves the stability, safety, and readability of the PIR tool without changing its core functionality.

Changes Made

Replaced unsafe pattern matches on Program with safe bindings.

Replaced raw error calls with friendly error messages + exitFailure.

Improved readability in retention analysis and name table generation.

Updated sorting using Down for cleaner intent.

Added simple CLI messages for better user feedback.

Added comments explaining intentional orphan instances.

Removed minor redundancies and improved formatting.

Why This Matters

These changes:

Prevent sudden crashes caused by pattern-match failures

Make CLI errors easier to understand

Improve maintainability

Do not change logic or output format

No Functional Behavior Changed

This PR is safe, review-friendly, and strictly improves code quality.
@Princevicks-Technologies
Copy link
Author

This PR improves the PIR tool by:

  • Replacing unsafe patterns with safer alternatives
  • Enhancing error handling and readability
  • Minor optimizations for analysis and CSV output

All CI checks are expected to pass; feedback is welcome.

Left e -> error $ show e
Right t -> writeProgram outp (pirFormatToFormat ofmt) mode
(Program () PLC.latestVersion(void t))
prog <- readProgram (pirFormatToFormat ifmt) inp

Choose a reason for hiding this comment

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

Honestly this is superb, Dev

This .hs file is easy to comprehend.

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.

2 participants