Conversation
…rcuit/AddServices names)
|
This PR is included in version 1.5.0 |
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
Make
Junctions()returnTask<Either<Exception, TReturn>>and the fluentMonadchain (Chain,Resolve,Extract,ShortCircuit,AddServices) compose asynchronously end to end. Method names are unchanged. The awaitable structMonadTask<TInput, TReturn>wrapsTask<Monad<,>>so.Chain<A>().Chain<B>().Resolve()keeps composing without forcing all generic type arguments at every link.Eliminates the deadlock class that bit Blazor Server / WPF consumers under single-threaded sync contexts. The previous suppression hack in
Monad.Chainwas a band-aid that moved the deadlock around rather than fixing it; with the chain truly async, the bug class is structurally impossible.What's deleted
TReturn(Monad<,>)operator (C# forbids implicitTask<T>conversion)Chain<TJunction, TIn, TOut>(... out Either<,>)overloads (outis illegal inasync)SynchronizationContextsuppression block inMonad.ChainTrainSyncContextTests.cs— the deadlock class is structurally impossible nowInternal renames
Chain→ChainJunction,ShortCircuitChain→ShortCircuitJunctionto free the public name space (so the public surface can offerChain<TJ, TIn, TOut>(TJ junction)returningMonadTask<,>without colliding with the reflection-invoked async helper).ReflectionHelpersupdated to match.Why MonadTask exists
C# does not perform partial generic inference between explicit type arguments and the receiver type. A plain extension method on
Task<Monad<,>>would force callers to write.Chain<JunctionA, MyInput, MyOutput>()at every continuation. Wrapping the Task in a struct that already knowsTInput/TReturnat the type level lets callers stick with.Chain<JunctionA>().Surprise: TrainChainAnalyzer needed no changes
The fluent member-access syntax tree the analyzer walks is unchanged — only the runtime types flowing through it differ. All 24 analyzer tests pass unmodified.
Test plan
dotnet buildzero warningsdotnet csharpier check .passesMigration
See Trax.Docs migration guide PR for the consumer-facing migration walkthrough. Versioned as a minor — consumers pinned via
Version="1.*"will pull this and need a one-line edit per train override before their projects compile.