docs: yieldable TaggedErrors and multi-tag catchTag - #5
Open
danielo515 wants to merge 12 commits into
Open
danielo515 wants to merge 12 commits into
danielo515 wants to merge 12 commits into
Conversation
…lock examples Add comprehensive documentation for: - Test variants (it.effect, it.live, it.scoped, it.scopedLive) - Effect-specific assertion utilities from @effect/vitest/utils - Error testing patterns including Effect.flip for simpler assertions - TestClock usage for time-dependent testing with delays, recurring effects, and Deferred
- Add blank lines after "**Correct:**" headers for consistent formatting - Remove unnecessary line breaks in yield* statements - Add new anti-pattern section for deprecated `_` adaptor in Effect.gen - Fix Schema.TaggedStruct usage example with missing tag parameter
- Remove unnecessary line break in yield* statement - Replace deprecated Config.secret with Config.redacted across all examples - Update secret configuration examples in observability patterns
Add navigation tables of contents to: - anti-patterns.md - effect-atom-patterns.md - effect-test-patterns.md - error-patterns.md - layer-patterns.md - observability-patterns.md - rpc-cluster-patterns.md - schema-patterns.md - service-patterns.md
Add comprehensive documentation for: - Equivalence and Order instances derived from schemas - Field-based comparisons using mapInput - Combining equivalences and orders for multi-criteria operations - Complete checklist for schedulable and durable types - Usage examples with Array operations Update layer-patterns.md with: - Layer type signature explanation - Merge vs Provide comparison section
…ommon patterns Add comprehensive documentation for: - Function atoms (Atom.fn) for side effects with cart example - Runtime with services including global layer configuration - useAtomSetPromise hook for async function atoms - Stream integration for real-time data - Pull atoms for pagination patterns - Scoped resources with automatic cleanup using acquireRelease - Common patterns: loading states, optimistic updates, and computed queries
…amples TaggedError instances implement the Effect interface, so Effect.fail() wrapping is unnecessary. Also document that catchTag accepts variadic tag strings for mapping multiple errors to a single handler, reducing boilerplate vs catchTags with duplicate handler bodies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Effect.fail()wrappers:Schema.TaggedErrorinstances are yieldable (they implement theEffectinterface), soEffect.fail(new SomeError(...))is replaced with justnew SomeError(...)across all examples in 6 filescatchTag:Effect.catchTagaccepts variadic tag strings (catchTag("A", "B", "C", handler)) for mapping multiple errors to a single handler, eliminating the need forcatchTagswith duplicate handler bodieserror-patterns.mdwith clear ✅/❌ examples and a note that plainErrorobjects still requireEffect.fail()Test plan
GenericErrorin FORBIDDEN examples still usesEffect.fail()(not a TaggedError)catchTagexamples match current Effect API