AnyLR 0.1.1
dotnet add package AnyLR --version 0.1.1
NuGet\Install-Package AnyLR -Version 0.1.1
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="AnyLR" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnyLR" Version="0.1.1" />
<PackageReference Include="AnyLR" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AnyLR --version 0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AnyLR, 0.1.1"
#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.
#:package AnyLR@0.1.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AnyLR&version=0.1.1
#tool nuget:?package=AnyLR&version=0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ANYLR.CS
This C# library provides discriminated union implementaions AnyOf<L, R>
, Either<L, R>
, Option<T>
, Result<T, E>
under namespace NsAnyLR
.
These are useful when out
modified parameter types are not available, for example, parameter types in async methods.
AnyOf<L, R>
May contain zero or one L, and zero or one R.
See tests code below:
const int LEFT = 1;
const uint RIGHT = 2u;
AnyOf<int, uint> a0, al, ar, a2;
a0 = AnyOf.None();
al = AnyOf.Left(LEFT);
ar = AnyOf.Right(RIGHT);
a2 = AnyOf.Both(LEFT, RIGHT);
Assert.That(a0.HasNone());
Assert.That(!a0.HasLeft());
Assert.That(!a0.HasRight());
Assert.That(!a0.HasBoth());
Assert.That(!al.HasNone());
Assert.That(al.HasLeft());
Assert.That(!al.HasRight());
Assert.That(!al.HasBoth());
Assert.That(!ar.HasNone());
Assert.That(!ar.HasLeft());
Assert.That(ar.HasRight());
Assert.That(!ar.HasBoth());
Assert.That(!a2.HasNone());
Assert.That(a2.HasLeft());
Assert.That(a2.HasRight());
Assert.That(a2.HasBoth());
Either<L, R>
May contain one and exactly only one value of type either L or R. See tests code below:
Either<int, int> el, er;
el = Either.Left(LEFT);
er = Either.Right(RIGHT);
var sqr = (int x) => x * x;
Assert.That(el.MapLeft(sqr).AsLeft().IsSome(out var lv) && lv == sqr(LEFT));
Assert.That(el.MapRight(sqr).TryRight().IsErr(out lv) && lv == LEFT);
Assert.That(er.MapRight(sqr).AsRight().IsSome(out var rv) && rv == sqr(RIGHT));
Assert.That(er.MapLeft(sqr).TryLeft().IsErr(out rv) && rv == RIGHT);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.