Skip to content

Pass Match.type handlers the matched input alone - #10875

Open
jasonkuhrt wants to merge 3 commits into
Effect-TS:mainfrom
jasonkuhrt:match-type-handler-input
Open

jasonkuhrt wants to merge 3 commits into
Effect-TS:mainfrom
jasonkuhrt:match-type-handler-input

Conversation

@jasonkuhrt

@jasonkuhrt jasonkuhrt commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #10873
Closes EFF-4231

Match.type handlers receive only the matched input again. Since #7363 they were called with (input, input), so passing parseInt as a handler read the input as the radix.

Changes

  • makeTypeMatcher records a forwardArgs flag at construction. It is true for Match.fn and false for Match.type, Match.typeTags and Match.valueTags, and add carries it over.
  • Match.result and Match.orElse read the flag once when the terminal is built and pass the original arguments to the handler only when it is set. Match.fn forwarding and all public types are unchanged.
  • typeTags and valueTags build their matcher with type(), so the unary decision lives in one place.
  • The repeated When/Not guard checks in result go through one matches helper.
  • Regression test in packages/effect/test/Match.test.ts for single-case Match.type (matched handler and orElse fallback), multi-case Match.type, and Match.typeTags.
  • Patch changeset for effect.

Verification

  • pnpm test --run packages/effect/test/Match.test.ts: 10/10 passed
  • pnpm test-types Match.tst.ts: 44/44 passed
  • pnpm lint-fix and pnpm check: clean
  • A local micro-benchmark of type, fn and value matchers shows no change from main.

Co-authored-by: Jason Kuhrt [email protected]

@changeset-bot

changeset-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 67bd37a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/chat-discord Patch
@effect/chat-slack Patch
@effect/chat-teams Patch
@effect/chat-telegram Patch
@effect/chat-whatsapp Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-cloudflare Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 40.17 KB 40.17 KB 0.00 KB (0.00%)
basic.ts 7.31 KB 7.31 KB 0.00 KB (0.00%)
batching.ts 11.29 KB 11.29 KB 0.00 KB (0.00%)
brand.ts 7.05 KB 7.05 KB 0.00 KB (0.00%)
cache.ts 11.75 KB 11.75 KB 0.00 KB (0.00%)
config.ts 23.18 KB 23.18 KB 0.00 KB (0.00%)
differ.ts 22.30 KB 22.30 KB 0.00 KB (0.00%)
http-client.ts 27.87 KB 27.87 KB 0.00 KB (0.00%)
http-router.ts 38.66 KB 38.66 KB 0.00 KB (0.00%)
logger.ts 12.19 KB 12.19 KB 0.00 KB (0.00%)
metric.ts 9.66 KB 9.66 KB 0.00 KB (0.00%)
optic.ts 7.28 KB 7.28 KB 0.00 KB (0.00%)
pubsub.ts 16.23 KB 16.23 KB 0.00 KB (0.00%)
queue.ts 13.13 KB 13.13 KB 0.00 KB (0.00%)
schedule.ts 11.99 KB 11.99 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.36 KB 14.36 KB 0.00 KB (0.00%)
schema-binary.ts 42.92 KB 42.92 KB 0.00 KB (0.00%)
schema-class.ts 22.01 KB 22.01 KB 0.00 KB (0.00%)
schema-codegen.ts 30.78 KB 30.78 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.64 KB 30.64 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.33 KB 28.33 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.61 KB 15.61 KB 0.00 KB (0.00%)
schema-string.ts 12.56 KB 12.56 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.50 KB 16.50 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.72 KB 39.72 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.20 KB 21.20 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.36 KB 21.36 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.45 KB 21.45 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.50 KB 26.50 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.54 KB 21.54 KB 0.00 KB (0.00%)
schema.ts 21.14 KB 21.14 KB 0.00 KB (0.00%)
stm.ts 14.48 KB 14.48 KB 0.00 KB (0.00%)
stream.ts 10.61 KB 10.61 KB 0.00 KB (0.00%)

This branch is waiting to be deployed

1 waiting deployment
fork — 67bd37a2 Waiting Nov 24, 2026 by effect-bot via approval-gate #27213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match.type handlers receive the matched input twice

2 participants