Skip to content

Take the error case first in Result.Match and Result.Switch - #1041

Open
FreeApophis wants to merge 1 commit into
async-2-0from
result-match-error-first
Open

FreeApophis wants to merge 1 commit into
async-2-0from
result-match-error-first

Conversation

@FreeApophis

Copy link
Copy Markdown
Member

Closes #683. Stacked on #1040 (base async-2-0), retarget once the chain #1037 → #1039 → #1040 has merged.

  • Result<T>.Match(ok, error) → Match(error, ok), Switch(ok, error) → Switch(error, ok), and the internal total Match(uninitialized, error, ok), as settled in the grooming of 21 Oct 2026. Every call in the repository names its arguments (λ1003), so none of them changed; the PublicAPI Unshipped files of all six Funcky assets get the two *REMOVED* lines and the two new ones.
  • AlternativeMonadAnalyzer (λ1005 to λ1007, λ1011) found Result's error-state argument by position (matchHasSuccessStateFirst). It now looks it up by parameter name (none, left, error), so Funcky.Analyzers 3.0.0 gives the same results against Funcky 3.x and 4.0.0. The analyzer test stubs mirror the 4.0.0 order; the existing tests already call Match with the arguments in both orders.
  • Docs: the comparison tables in the Result and Either chapters, the examples in λ1005, λ1006, the FP overview, the Result chapter and the README show the error case first. Changelog entry under 4.0.0.

Verified locally: Release build of the solution with TreatWarningsAsErrors, Funcky.Test on all four frameworks, Funcky.Xunit and Funcky.Xunit.v3 tests, Funcky.Async.Test, and Funcky.Analyzers.Test 262/262.

🤖 Generated with Claude Code

Result<T>.Match(ok, error) and Switch(ok, error) become Match(error, ok) and
Switch(error, ok), consistent with Option.Match(none, some) and
Either.Match(left, right). Both carry [UseWithArgumentNames], so every call
in the repository already names its arguments and survives the swap; the
PublicAPI files record the old and the new signatures. The alternative monad
analyzer no longer assumes a position for Result's error-state argument but
finds it by parameter name, so Funcky.Analyzers 3.0.0 works with Funcky 3.x
and 4.0.0 alike. The documentation examples show the error case first.

Closes #683

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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