Skip to content

fix(stdlib): single-ownership dedup of prelude/option/result (#133)#152

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/133-stdlib-dedup
May 17, 2026
Merged

fix(stdlib): single-ownership dedup of prelude/option/result (#133)#152
hyperpolymath merged 1 commit into
mainfrom
fix/133-stdlib-dedup

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

What

Fixes #133 — removes the duplicate & signature-divergent definitions across prelude/option/result so there is exactly one canonical binding per name, per ADR-011 (#132): real modules + single ownership.

Ownership

Module Owns
prelude core sum types Option/Result (+ ctors); generic list/numeric utils (map(arr), filter(arr), fold, contains(arr), sum, min, range, …)
option all Option ops (is_some/is_none/unwrap/unwrap_or/map/filter/contains/…)
result all Result ops (is_ok/is_err/unwrap/unwrap_or/map_ok/…)

prelude.affine drops the 8 duplicate/conflicting Option/Result ops it previously also defined; option/result declare module + use prelude::{…} for the types.

The old flat-namespace conflicts (prelude.map(arr,f) vs option.map(f,opt); prelude.unwrap(Option) vs result.unwrap(Result)) are now module::name — exactly one definition per owning module ("or properly module-qualified ones", per the issue).

Verification

  • No leftover duplicate defs; no retained prelude util calls a removed op.
  • Full suite green: 214 tests, zero regressions.

Merge note

This removes the prelude unwrap/unwrap_result that #134 (PR #150) patched. The sound, panicking versions are option::unwrap / result::unwrap (already correct); #150's regression tests stay valid against those. If #150 lands first, resolve the modify/delete in prelude.affine in favour of this deletion.

Depends on the #132 decision (ADR-011). Closes #133. Refs #128.

🤖 Generated with Claude Code

Per ADR-011 (#132): one canonical binding per name, module-owned.

- prelude.affine: `module prelude;`. Keeps the core sum types
  `Option`/`Result` (+ constructors) as their canonical home and the
  generic list/numeric utilities. Removes the 8 duplicate/conflicting
  Option/Result *operations* it previously also defined (is_some,
  is_none, unwrap, unwrap_or, is_ok, is_err, unwrap_result,
  unwrap_or_result).
- option.affine: `module option;` + `use prelude::{Option, Some, None,
  Result, Ok, Err};`. Now the single canonical home for Option ops.
- result.affine: `module result;` + `use prelude::{Result, Ok, Err,
  Option, Some, None};`. Single canonical home for Result ops.

The previous flat-namespace conflicts (`prelude.map(arr,f)` vs
`option.map(f,opt)`; `prelude.unwrap`(Option) vs `result.unwrap`(Result))
are resolved by module ownership — each is now `module::name`, exactly
one definition per owning module. Verified: no leftover dup defs, no
prelude util calls a removed op, full suite green (214 tests).

Note: this removes the prelude `unwrap`/`unwrap_result` that #134
(PR #150) patched; the sound, panicking versions are `option::unwrap`
and `result::unwrap` (already correct). #150's regression tests remain
valid against those. Merge-order: if #150 lands first, resolve the
modify/delete in prelude.affine in favour of this deletion.

Closes #133
Refs #128, #132

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath enabled auto-merge (squash) May 17, 2026 05:50
@hyperpolymath hyperpolymath force-pushed the fix/133-stdlib-dedup branch from 557f00b to 6bf9028 Compare May 17, 2026 05:51
@hyperpolymath hyperpolymath merged commit 63ade78 into main May 17, 2026
0 of 12 checks passed
@hyperpolymath hyperpolymath deleted the fix/133-stdlib-dedup branch May 17, 2026 05:52
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.

stdlib: remove prelude/option/result duplicate & conflicting definitions

1 participant