leo.blog();

Effect in dotnet

There is no single Effect equivalent in Dotnet. Effect bundles typed errors, DI, concurrency, retries, resources and observability, and in .NET you either adopt LanguageExt fully or assemble separate libraries.

Closest in spirit

Piece by piece

Effect feature .NET option
Typed errors / Either ErrorOr, FluentResults, OneOf, CSharpFunctionalExtensions, LanguageExt Fin/Either
Retry, timeout, circuit breaker Kevlar, Polly (see below), LanguageExt Schedule
DI (Layer, Context) Microsoft.Extensions.DependencyInjection, Autofac, Scrutor
Fibers, structured concurrency Task, CancellationToken, Task.WhenAll, TPL Dataflow, Parallel.ForEachAsync
Streams IAsyncEnumerable<T>, System.Threading.Channels, Rx.NET, System.Linq.Async
Resource safety (Scope) IDisposable, IAsyncDisposable, using
Schema validation FluentValidation, System.Text.Json source generators, Vogen
Observability OpenTelemetry .NET, ActivitySource, ILogger, Serilog
Actors / workflows Akka.NET, Orleans, Proto.Actor, Temporal, Dapr Workflows
ADTs / pattern matching switch expressions, OneOf, Dunet. Unions planned for C# 15.

Resilience: Kevlar vs Polly

Polly is introducing an Open Source Maintenance Fee (OSMF) effective 2026-11-16, enforced via an EULA on the binary of the next major version. Reportedly about $20/month per organization with at least $20k revenue. Source stays BSD-3 and existing versions are unaffected. Microsoft.Extensions.Http.Resilience depends on Polly, so it is affected too.

Kevlar (https://github.com/thomhurst/Kevlar, docs https://kevlar.tomlonghurst.dev/) is an MIT-licensed alternative by Tom Longhurst (author of TUnit). Young (0.x), single main maintainer.

var shield = Shield
    .Timeout(TimeSpan.FromSeconds(30))   // total budget
    .When<HttpRequestException>()
    .Retry(3)                            // 4 attempts, exp backoff + jitter
    .CircuitBreaker(consecutiveFailures: 5, breakDuration: TimeSpan.FromSeconds(30))
    .Timeout(TimeSpan.FromSeconds(5));   // per attempt

await shield.ExecuteAsync(ct => client.GetAsync(url, ct));

Other options: pin Polly v8 or watch for a community fork; LanguageExt Schedule; hand-rolled Task + CancellationToken + System.Threading.RateLimiting.

Which to pick

Nothing in .NET matches Effect's single type-tracked Effect<A, E, R>. Kevlar only covers the resilience part.

Backlinks

Leave a Comment