Improve error handling, safety, readability; replace unsafe patterns.#7446
Improve error handling, safety, readability; replace unsafe patterns.#7446Princevicks-Technologies wants to merge 1 commit intoIntersectMBO:masterfrom
Conversation
… 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.
|
This PR improves the PIR tool by:
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 |
There was a problem hiding this comment.
Honestly this is superb, Dev
This .hs file is easy to comprehend.
There was a problem hiding this comment.
I think this quite literally made it worse. But feel free to elaborate how it is superb.
zliu41
left a comment
There was a problem hiding this comment.
You removed most if not all comments from this module. Why do you think they should be removed?
Replacing unsafe patterns with safer alternatives
Which specific patterns were unsafe? Please elaborate
Enhancing error handling and readability
How is error handling improved? Please elaborate
Minor optimizations for analysis and CSV output
What optimizations? How do they work? Please elaborate
| Left e -> error $ show e | ||
| Right t -> writeProgram outp (pirFormatToFormat ofmt) mode | ||
| (Program () PLC.latestVersion(void t)) | ||
| prog <- readProgram (pirFormatToFormat ifmt) inp |
There was a problem hiding this comment.
I think this quite literally made it worse. But feel free to elaborate how it is superb.
… 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: