Skip to content

feat(effects): thread parametric Throws[E] type argument (Refs #59)#204

Merged
hyperpolymath merged 1 commit into
mainfrom
stage-b/parametric-throws
May 18, 2026
Merged

feat(effects): thread parametric Throws[E] type argument (Refs #59)#204
hyperpolymath merged 1 commit into
mainfrom
stage-b/parametric-throws

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

STAGE-B cleanup — parametric Throws[E]

lower_effect_expr dropped EffCon type args, so Throws[MyErr] collapsed to bare Throws — the type parameter the #59 v1 list specifies (Throws[E]) was invisible in the effect representation.

Change

EffCon args are now mangled into the effect singleton: Throws[MyErr]ESingleton "Throws[MyErr]", distinct from Throws[Other] and bare Throws under eff's string-equality unification.

Chosen over adding a parametric variant to the eff ADT — that would ripple across every effect operation in effect.ml/unify.ml, disproportionate for a cleanup. The base name is still validated through the v1 registry.

Scope (honest)

This is effect tracking only. AffineScript does not currently enforce effect-annotation subsumption at call sites — verified: even IO body vs Mut decl, or pure body vs IO decl, pass today. Strict effect checking / handler semantics are the separately-deferred work (migration-stance guide; #59: "tracking alone gives most of the value"). This PR makes the tracked form carry E; it deliberately does not add enforcement.

Verification

  • dune build clean; dune test --force 253/253, zero regression.
  • Bogus[Int] still rejected → the parametric path runs and base-name validation works.
  • Throws[Int] lowers distinctly from Throws[String] / bare Throws by construction.

Refs #59

STAGE-B cleanup. lower_effect_expr dropped EffCon type args, so
`Throws[MyErr]` collapsed to bare `Throws` — the type parameter the
#59 v1 list calls for (`Throws[E]`) was invisible.

Now the args are mangled into the effect singleton:
`Throws[MyErr]` -> ESingleton "Throws[MyErr]", distinct from
`Throws[Other]` and bare `Throws` under the string-equality
unification of `eff`. Chosen over growing the `eff` ADT with a
parametric variant (which would ripple across every effect operation
in effect.ml/unify.ml — disproportionate for this cleanup). The base
name is still validated via the v1 registry (`Bogus[E]` is still
rejected — verified).

Scope: this is effect *tracking* only. AffineScript does not currently
*enforce* effect-annotation subsumption at call sites (verified: even
`IO` body vs `Mut` decl passes today) — strict effect checking /
handler semantics remain the separately-deferred work (migration-stance
doc; #59 "tracking alone gives most of the value"). This PR makes the
tracked form carry `E`; it does not add enforcement.

dune build clean; dune test --force 253/253, zero regression.

Refs #59

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath enabled auto-merge (squash) May 18, 2026 08:17
@hyperpolymath hyperpolymath merged commit 9f8a6ed into main May 18, 2026
@hyperpolymath hyperpolymath deleted the stage-b/parametric-throws branch May 18, 2026 08:17
hyperpolymath added a commit that referenced this pull request May 18, 2026
#209)

The #207 squash-merge landed only the code commit; the docs commit
(235e161) never reached main, leaving SPEC.adoc §3.4 still showing the
retired Exn[Error] and lib/effect.ml still claiming Throws[E] is 'not
yet threaded' — both now stale/incorrect on main. Re-landing them:

- SPEC.adoc §3.4: Exn[Error] → Throws[E]; new 'Effect inference
  (tracking-only v1)' subsection (catch-less try/? ⇒ Partial; declared
  rows enforced inferred⊆declared; undeclared permissive);
  'Partial by Default' disambiguated from the Partial effect.
- lib/effect.ml: corrected the doc-drift comment (#204 threads
  Throws[E] via name-mangling in Typecheck.lower_effect_expr).

Pure docs/comment; gate unchanged. Refs #59 (closed — lineage only,
do not reopen).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 44 issues detected

Severity Count
🔴 Critical 12
🟠 High 21
🟡 Medium 11

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stray AI.a2ml in root -- use 0-AI-MANIFEST.a2ml only",
    "type": "banned",
    "file": "AI.a2ml",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Superseded by 0-AI-MANIFEST.a2ml",
    "type": "banned",
    "file": "AI.djot",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/example/smoke_driver.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/cli.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/compile.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/runner.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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.

1 participant