Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Source generator for the monad cross products (Traverse/Sequence, Partition, Task binds, applicative lifting)

Aperta
#1,036 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
tooling

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

enhancement to discuss

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 names Return, Match, the cases, and per-type annotations the generated code must carry (e.g. the DynamicallyAccessedMembers constraints of Lazy<T>).
  • An incremental generator in Funcky.SourceGenerator (next to ApplyGenerator and OrNoneFromTryPatternGenerator) that reads the descriptions and emits the matrix above, including the XML documentation.
  • Generated families, in order of value:
    1. Traverse / Sequence for every (inner, outer) pair, replacing the six hand-written files.
    2. 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.
    3. Applicative lifting (Lift(f, a, b, …) / Zip) over arities, like ApplyGenerator does for Func, for Option, Result, Either and 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.
    4. Partition* and WhereSelect, 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.SourceGenerator in 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 Match rules 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di polyadic/funcky

Tutte le issue di polyadic/funcky

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.