RhoMicro.AlgebraicEffects 1.1.0

There is a newer version of this package available.
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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RhoMicro.AlgebraicEffects" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RhoMicro.AlgebraicEffects --version 1.1.0                
#r "nuget: RhoMicro.AlgebraicEffects, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 254 12/9/2023
1.1.0 132 12/9/2023
1.0.1 144 12/9/2023
1.0.0 133 12/9/2023