RhoMicro.AlgebraicEffects
1.1.0
See the version list below for details.
dotnet add package RhoMicro.AlgebraicEffects --version 1.1.0
NuGet\Install-Package RhoMicro.AlgebraicEffects -Version 1.1.0
<PackageReference Include="RhoMicro.AlgebraicEffects" Version="1.1.0" />
paket add RhoMicro.AlgebraicEffects --version 1.1.0
#r "nuget: RhoMicro.AlgebraicEffects, 1.1.0"
// Install RhoMicro.AlgebraicEffects as a Cake Addin #addin nuget:?package=RhoMicro.AlgebraicEffects&version=1.1.0 // Install RhoMicro.AlgebraicEffects as a Cake Tool #tool nuget:?package=RhoMicro.AlgebraicEffects&version=1.1.0
RhoMicro.AlgebraicEffects
Provides an implementation of algebraic effects for C#.
If you are new to algebraic effects, here is a great explanation: https://overreacted.io/algebraic-effects-for-the-rest-of-us/
How to Use
Effects can be handles using the Effect<>
type:
Effect<AskForName>.Handle(EffectHandler<T> handler)
Effect<AskForName>.HandleAsync(AsyncEffectHandler<T> handler)
Handle
and HandleAsync
both return an instance of IDisposable
that manages the lifetime of the handler registration:
EffectHandler<T> myHandler = static () => EffectHandlerResult<T>.CreateFromResult("Some Result");
using(var lt = Effect<T>.Handle(myHandler)){
//methods called here may receive the handler
}
//the handler is unregistered, methods called here may not receive it
Effects may be handled and performed synchronously or asynchronously:
EffectHandler<T> syncHandler = static () => EffectHandlerResult<T>.CreateFromResult("Some Result");
using var _ = Effect<T>.Handle(syncHandler);
EffectHandler<T> asyncHandler = static () => Task.FromResult(EffectHandlerResult<T>.CreateFromResult("Some Result"));
using var _ = Effect<T>.HandleAsync(asyncHandler);
var missingData = Effect<T>.Perform();
var moreMissingData = await Effect<T>.PerformAsync();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.