Skip to content
Discussion options

You must be logged in to vote

Thanks for the kind words, and for asking — this was a fair thing to be unsure about.

Confirming: TaggedError is not a requirement. Result<T, E> is generic in E and unconstrained — there is no E extends { _tag: string } anywhere in core, and P.tag("X") is only sugar for the object pattern { _tag: "X" }, one pattern among several. Your existing error types work as-is: match on a kind / code field with an object pattern, on an untagged class with P.instanceOf, on anything else with P.when. The only real requirement is that E is a union TypeScript can discriminate, since exhaustiveness is Exclude over it — the same thing a switch needs.

And the modelled/unexpected split you were reaching for…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rrmesquita
Comment options

Answer selected by rrmesquita
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request
2 participants
Converted from issue

This discussion was converted from issue #235 on August 14, 2026 21:15.