Tkheikkila.FunctionalTypes
2.0.0
dotnet add package Tkheikkila.FunctionalTypes --version 2.0.0
NuGet\Install-Package Tkheikkila.FunctionalTypes -Version 2.0.0
<PackageReference Include="Tkheikkila.FunctionalTypes" Version="2.0.0" />
<PackageVersion Include="Tkheikkila.FunctionalTypes" Version="2.0.0" />
<PackageReference Include="Tkheikkila.FunctionalTypes" />
paket add Tkheikkila.FunctionalTypes --version 2.0.0
#r "nuget: Tkheikkila.FunctionalTypes, 2.0.0"
#:package Tkheikkila.FunctionalTypes@2.0.0
#addin nuget:?package=Tkheikkila.FunctionalTypes&version=2.0.0
#tool nuget:?package=Tkheikkila.FunctionalTypes&version=2.0.0
Tkheikkila.FunctionalTypes
Useful types missing from C#
Inspired by Rust's
std::unit
,
std::option::Option
, and
std::result::Result
.
Unit
AKA: void
Contains no information other that it's type.
Maybe<T>
AKA: Option
or Optional
A value that may or may not contain a value of type T
.
This type has two states:
Some
that contains a single value of typeT
Created by callingMaybe<T>.Some(value)
.None
that contains no value
Created by callingMaybe<T>.None()
or by returningdefault
.
Result<TValue, TError>
AKA: Either
A value that can be in one of two states, but never both.
These states are:
Ok
that indicates success with a value of typeTValue
Created by callingResult<TValue, TError>.Ok(value)
.Error
that indicates failure with a value of typeTError
Created by callingResult<TValue, TError>.Error(error)
MaybeResult<TValue, TError>
A combination of Maybe<T>
and Result<TValue, TError>
.
Equivalent to Maybe<Result<TValue, TError>>
Resembles Result<Maybe<TValue>, TError>
and Result<TValue, Maybe<TError>>
This type has three states:
Ok
that indicates success with a value of typeTValue
Created by callingMaybeResult<TValue, TError>.Ok(value)
.Error
that indicates failure with a value of typeTError
Created by callingMaybeResult<TValue, TError>.Error(error)
.Neither
that indicates that neither a value of typeTValue
nor a value of typeTError
is present Created by callingMaybeResult<TValue, TError>.Neither()
.
GreedyValidationResult<TValue, TError>
A value that contains a value of type TValue
and a collection of errors of type TError
.
Resembles Result<TValue, List<TError>>
with a value of type TValue
that is always present.
Resembles LazyValidationResult<TValue, TError>
with a collection of errors of type TError
.
This type has two states:
Valid
that contains no errorsInvalid
that contains one or more errors of typeTError
Created by calling Validation.Greedy<TValue, TError>(value)
.
Errors can be added by calling AddError(error)
, one of the AddErrors
overloads, or one of the Validate
overloads that returns a value of TError
.
LazyValidationResult<TValue, TError>
A value that contains a value of type TValue
. If the value is invalid, it also contains a single error of type TError
.
Resembles GreedyValidationResult<TValue, TError>
with a maximum of one error.
Resembles Result<TValue, TError>
with a value of type TValue
that is always present.
This type has two states:
Valid
that contains no errorsInvalid
that contains single error of typeTError
Created by calling Validation.Lazy<TValue, TError>(value)
.
Error can be set by calling one of the Validate
overloads that returns a value of TError
.
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. |
-
.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.
Version | Downloads | Last Updated |
---|---|---|
2.0.0 | 124 | 11/14/2024 |
2.0.0-rc.4 | 65 | 11/14/2024 |
2.0.0-rc.3 | 57 | 10/22/2024 |
1.0.0 | 571 | 6/3/2022 |