Source generator for the monad cross products (Traverse/Sequence, Partition, Task binds, applicative lifting)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start by reading the existing ApplyGenerator and OrNoneFromTryPatternGenerator in Funcky.SourceGenerator, then inspect the six traversable extension files and monad types to map the five described facts. Check the outcomes of #862 and #1034 first, since this work depends on them. Done means an incremental generator emits the Traverse / Sequence matrix with XML documentation and the trimming annotations are exercised by Funcky.TrimmingTest.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The "else" branch of the trait spike #862: if 4.0.0 does not adopt higher-kinded traits, the duplication the traits would have removed is generated instead. Decided at the 4.0.0 grooming on 29 Oct 2026; depends on the outcome of #862 and #1034.
Where the duplication is
SelectMany itself is not the target: two overloads per monad, each a few lines, and they define the type. The cost sits in the cross products built on top of them:
| Family | Shape today | Size |
|---|---|---|
Traverse / Sequence |
3 monads × 5 sync outer types (Either, Result, Lazy, IEnumerable, Reader) + 3 async (IAsyncEnumerable, Task, ValueTask) |
483 lines in *Extensions.Traversable.cs / *AsyncExtensions.Traversable.cs, all the same five-line body |
Partition, PartitionEither, PartitionResult, WhereSelect |
per monad, once for IEnumerable and once for IAsyncEnumerable |
181 lines sync, mirrored async |
Cross-monad SelectMany on Task<Option<T>>, Task<Result<T>>, … |
does not exist yet, this is #864 | monads × {Task, ValueTask} × 2 overloads |
Every body in the first row needs three facts about the inner monad (Return, Match, the case names) and two about the outer one (Return, Select/SelectMany). That is a monad description of five facts per type.
Proposal
- An attribute on each monad type (working name
[Monad]) that namesReturn,Match, the cases, and per-type annotations the generated code must carry (e.g. theDynamicallyAccessedMembersconstraints ofLazy<T>). - An incremental generator in
Funcky.SourceGenerator(next toApplyGeneratorandOrNoneFromTryPatternGenerator) that reads the descriptions and emits the matrix above, including the XML documentation. - Generated families, in order of value:
Traverse/Sequencefor every (inner, outer) pair, replacing the six hand-written files.- The
Task<M<T>>/ValueTask<M<T>>binds of #864: with the generator, "Task as a monad" becomes a row in the table, and the exception-swallowing question is answered per generated overload instead of by a new type. - Applicative lifting (
Lift(f, a, b, …)/Zip) over arities, likeApplyGeneratordoes forFunc, forOption,Result,Eitherand the Validation applicative of #802. Validation differs only in accumulating instead of short-circuiting, which is a per-type fact the description carries. One generator, every applicative. Partition*andWhereSelect, so the sync and async twins cannot drift apart.
Explicitly not generated
Inspect, OrElse, GetOrElse, Flatten, Where, the JSON converters, the xunit serializers and the comparers: a handful of lines each with type-specific quirks, and their hand-written XML docs are what users read in IntelliSense.
Decisions to take when it starts
- Internal or shipped. Today the generator runs only inside the Funcky build. Shipping it (as
Funcky.SourceGeneratorin the package, the way the analyzers ship) would let a consumer put the attribute on their own monad and get the full matrix against Funcky's types, which is the one use case the #862 assessment said nobody had asked for, delivered without trait machinery. Start internal, keep the door open. - Trimming and AOT. The per-type annotation slot must be exercised by
Funcky.TrimmingTest, which keeps rooting both assemblies. - Analyzers. The
Matchrules and the alternative-monad rule special-case the three types by name today; the same attribute could feed them. Nice side effect, not a reason on its own.
Related: #862, #1034, #864, #802, #1035 (umbrella).
- Lingua principale
- C#
- Stelle
- 55
- Fork
- 6
- Merge medio
- 1g 21m
- PR unite (30g)
- 90
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di polyadic/funcky
-
Assertion failure label must become Assert.X() when FunctionalAssert is removedForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
blocked
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
polyadic/funcky#868 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
breaking change
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
-
experimental to discuss
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
Documentation: upgrade guide for 4.0.0 (and the older upgrades the book never got)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadocs
Difficoltà 4/5 3-5 giorni Idoneità per principianti 43/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di polyadic/funcky
Issue simili
-
possible bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Include host.wslc.internal in the HTTPS development certificateForse già presa @afscrome l’ha presa oggi. Apertaarea-commandlinetools
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
dotnet/aspnetcore#70122 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
:1st_place_medal: good first issue :cowboy_hat_face: refactor :roller_coaster: enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ApplETS/Backend-Hello#78 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 2 giorni
-
Custom component in Summary2 no longer receives raw formData (regression from app-frontend v4)Apertastatus/triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Altinn/altinn-studio#21642 ·
I maintainer di solito rispondono entro 1 giorno