Skip to content

fix: print negated exponents without parentheses - #1

Merged
mcaney006 merged 1 commit into
mainfrom
review-fixes
Sep 30, 2026
Merged

mcaney006 merged 1 commit into
mainfrom
review-fixes

Conversation

@mcaney006

@mcaney006 mcaney006 commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Fixes found in review.

  • The printer wrapped a negated exponent in parentheses: 2 ^ -1 printed as 2 ^ (-1), and :type showed the extra parentheses. Negation now shares the precedence of exponentiation. The parser accepts the same inputs as before, since no operator had precedence 3.
  • A lone : in the interactive session is treated as a blank line instead of an unknown command.
  • withSemiring is renamed withCarrier; it supplies both Semiring and Height.
  • The interpreter maps a missing result to DivisionByZero in one helper instead of two call sites.
  • Tests read the magnitude bound from defaultConfiguration instead of repeating the literal.
  • The README states that piped input prints errors in place of results and exits 0.

Tests: 204 examples, 0 failures. The three new printer tests fail against the previous precedence.


Note

Low Risk
Precedence and printing tweaks with small REPL and refactor changes; behavior is covered by expanded tests and matches documented Python-style rules.

Overview
Printing and precedence: Unary negation now uses the same precedence level as exponentiation (negationPrecedence 3 → 4), so canonical output and :type show forms like 2 ^ -1 instead of 2 ^ (-1). Parser behavior is unchanged because no other operator used precedence 3.

REPL and docs: A line that is only : is parsed as a blank line, not an unknown command. The README documents piped/batch mode: errors print in place of results, later lines still run, exit status stays 0, and the example count is updated to 204.

Refactors: Validation renames withSemiring to withCarrier (still supplies Semiring and Height). The interpreter consolidates division-by-zero handling into orDivisionByZero instead of refuseZero at divide and integer-power sites.

Tests: Parser specs add minimal-print and redundant-parenthesis cases (including negated exponents). Interpreter and render specs take the magnitude bound from defaultConfiguration; REPL specs cover : as blank.

Reviewed by Cursor Bugbot for commit a8bbf41. Configure here.

Negation now shares the precedence of exponentiation, so the printer leaves -1 bare in 2 ^ -1, matching the grammar. The parser accepts exactly the same inputs as before, because no operator had precedence 3.

Also: a lone : is a blank line rather than an unknown command; withSemiring is renamed withCarrier; the interpreter maps a missing result to DivisionByZero in one place; tests read the magnitude bound from the default configuration; the README states how piped input reports errors.
Copilot AI balanced review requested due to automatic review settings September 30, 2026 18:25
@ecc-tools

ecc-tools Bot commented Sep 30, 2026

Copy link
Copy Markdown

ECC Tools / Security Evidence

Commit: a8bbf415e3e21381e19b6b6d899dbcded54b549b

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 9 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 30, 2026

Copy link
Copy Markdown

ECC Tools / PR Risk Taxonomy

Commit: a8bbf415e3e21381e19b6b6d899dbcded54b549b

PR taxonomy clear (success)

Scanned 9 changed file(s). No taxonomy bucket signals were detected.

Scanned 9 changed file(s).

No PR taxonomy bucket signals were detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@ecc-tools

ecc-tools Bot commented Sep 30, 2026

Copy link
Copy Markdown

ECC Tools / Reference Set Readiness

Commit: a8bbf415e3e21381e19b6b6d899dbcded54b549b

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 9 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 30, 2026

Copy link
Copy Markdown

ECC Tools / Hosted Promotion Readiness

Commit: a8bbf415e3e21381e19b6b6d899dbcded54b549b

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 9 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T18:27:30.285278Z a8bbf41 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 84d48f41-e9ec-45fa-a7dc-40d45961b841

📥 Commits

Reviewing files that changed from the base of the PR and between befd361 and a8bbf41.

📒 Files selected for processing (9)
  • README.md
  • src/Calculator/Interpreter.hs
  • src/Calculator/Repl.hs
  • src/Calculator/Syntax.hs
  • src/Calculator/Validation.hs
  • test/Calculator/InterpreterSpec.hs
  • test/Calculator/ParserSpec.hs
  • test/Calculator/RenderSpec.hs
  • test/Calculator/ReplSpec.hs
 _____________________________________________________
< Your types are doing parkour to avoid being useful. >
 -----------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mcaney006
mcaney006 merged commit 74930e2 into main Sep 30, 2026
6 of 8 checks passed
@mcaney006
mcaney006 deleted the review-fixes branch September 30, 2026 18:26
@cursor

cursor Bot commented Sep 30, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_c8cf2147-eabc-4c7b-b734-6a40802d9c04)

@gitar-bot

gitar-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new empty-name guard silently ignores directives containing non-whitespace text after a spaced colon.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates expression printing, REPL handling, error conversion, and test configuration.

Changes:

  • Prints negated exponents without redundant parentheses.
  • Handles a lone : as blank input and documents batch-mode errors.
  • Consolidates helper logic and removes duplicated test constants.
File Description
src/​Calculator/​Syntax.hs Aligns negation and exponentiation precedence.
src/​Calculator/​Repl.hs Handles empty directive names.
src/​Calculator/​Interpreter.hs Centralizes division-by-zero conversion.
src/​Calculator/​Validation.hs Renames the carrier-evidence helper.
test/​Calculator/​ParserSpec.hs Expands canonical printer coverage.
test/​Calculator/​ReplSpec.hs Tests lone-colon handling.
test/​Calculator/​InterpreterSpec.hs Uses the configured magnitude bound.
test/​Calculator/​RenderSpec.hs Uses default configuration and typed errors.
README.md Documents batch behavior and updates test count.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Calculator/Repl.hs Resolved

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

Raises negationPrecedence so printSyntax now prints forms like 3 * -2, 1 - -2 and 2 ^ -1 without parentheses, and treats a bare : as a Blank line rather than a directive. Folds the interpreter's division-by-zero handling into one orDivisionByZero helper shared by Divide and IntegerPower, and renames withSemiring to withCarrier. Tests now take the magnitude bound from defaultConfiguration instead of hard-coding it, and the README documents that piped input prints each line's error in place of its result, keeps going, and exits 0.

No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 123 functions depend on the 104 functions this change touches.

Health — this change adds coupling hotspots:

  • new: step() — 4 callers, 6 callees
  • new: present() — 3 callers, 5 callees
  • new: diagnose() — 3 callers, 4 callees
  • new: spec() — 0 callers, 7 callees
  • new: go() — 0 callers, 6 callees
  • new: spec() — 0 callers, 6 callees
  • new: spec() — 0 callers, 6 callees

Verification — 123 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 123 function(s) in the blast radius were not formally verified this run

· 7 more finding(s) on lines outside this diff (see the check run).

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