Skip to content

[codex] Use tuple effect constructor arguments - #247

Draft
briancavalier wants to merge 4 commits into
mainfrom
codex/gadt-proxy-effects
Draft

[codex] Use tuple effect constructor arguments#247
briancavalier wants to merge 4 commits into
mainfrom
codex/gadt-proxy-effects

Conversation

@briancavalier

@briancavalier briancavalier commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • refactor Effect(id)<Arg, Answer> to Effect(id)<ArgsTuple, Answer> while keeping inherited of(...) constructors
  • pack constructor args as void for zero args, the value for one arg, and a readonly tuple for multi-arg effects
  • refactor ScopedEffect to preserve scope as the first constructor argument and use tuple args for the operation payload
  • migrate existing effect declarations, zero-arg scoped construction sites, docs, and examples including the guessing game
  • extend source and package-import inference tests for zero-, one-, and multi-arg constructor behavior

Notes

This keeps the fine-grained class + union effect model intact. Existing structured payloads remain single constructor arguments; the tuple describes constructor arity rather than redesigning domain payloads. Higher-order or non-trivial smart constructors can still be written explicitly.

Validation

  • corepack pnpm build
  • corepack pnpm typecheck
  • corepack pnpm test
  • corepack pnpm lint

Inspected dist/Effect.d.ts; the public constructor signatures show the tuple-based EffectClass and ScopedEffectClass API with internal support aliases.

@briancavalier briancavalier changed the title [codex] Add proxy effect namespaces [codex] Add static effect constructors Jun 30, 2026
@briancavalier briancavalier changed the title [codex] Add static effect constructors [codex] Use tuple effect constructor arguments Jun 30, 2026
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