Pure.Primitives.Switches
2.0.0
dotnet add package Pure.Primitives.Switches --version 2.0.0
NuGet\Install-Package Pure.Primitives.Switches -Version 2.0.0
<PackageReference Include="Pure.Primitives.Switches" Version="2.0.0" />
<PackageVersion Include="Pure.Primitives.Switches" Version="2.0.0" />
<PackageReference Include="Pure.Primitives.Switches" />
paket add Pure.Primitives.Switches --version 2.0.0
#r "nuget: Pure.Primitives.Switches, 2.0.0"
#:package Pure.Primitives.Switches@2.0.0
#addin nuget:?package=Pure.Primitives.Switches&version=2.0.0
#tool nuget:?package=Pure.Primitives.Switches&version=2.0.0
Pure.Primitives.Switches
Switch-based conditional primitives for the Pure ecosystem — evaluate one of N branches based on a discriminant value.
Overview
Pure.Primitives.Switches provides a *Switch type for every primitive in the Pure ecosystem. Each switch type holds a discriminant value and a collection of (predicate, result) branches, evaluating the first branch whose predicate matches and returning the associated result.
Types
| Type | Implements | Discriminant |
|---|---|---|
BoolSwitch |
IBool |
IBool |
CharSwitch |
IChar |
IChar |
StringSwitch |
IString |
IString |
NumberSwitch<T> |
INumber<T> |
INumber<T> |
GuidSwitch |
IGuid |
IGuid |
DateSwitch |
IDate |
IDate |
TimeSwitch |
ITime |
ITime |
DateTimeSwitch |
IDateTime |
IDateTime |
DayOfWeekSwitch |
IDayOfWeek |
IDayOfWeek |
Design Principles
- Lazy evaluation — branches are evaluated only when the value property is accessed.
- Composable — switch results are Pure primitives and can be nested inside other operations.
- AOT-compatible — no reflection; fully compatible with Native AOT.
Dependencies
Pure.Primitives.Abstractions— Pure primitive interfaces
| 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 is compatible. 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 is compatible. 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 is compatible. 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. net11.0 is compatible. |
-
net10.0
- Pure.HashCodes.Abstractions (>= 1.0.0)
- Pure.Primitives (>= 3.8.0)
-
net11.0
- Pure.HashCodes.Abstractions (>= 1.0.0)
- Pure.Primitives (>= 3.8.0)
-
net7.0
- Pure.HashCodes.Abstractions (>= 1.0.0)
- Pure.Primitives (>= 3.8.0)
-
net8.0
- Pure.HashCodes.Abstractions (>= 1.0.0)
- Pure.Primitives (>= 3.8.0)
-
net9.0
- Pure.HashCodes.Abstractions (>= 1.0.0)
- Pure.Primitives (>= 3.8.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Pure.Primitives.Switches:
| Package | Downloads |
|---|---|
|
Pure.RelationalSchema.Self.Storage.Introjection
Package Description |
|
|
Pure.RelationalSchema.Storage.PostgreSQL.Creation
Package Description |
|
|
Pure.RelationalSchema.Storage.PostgreSQL.Upserting
PostgreSQL row upserting for the Pure relational schema ecosystem — MERGE decorators over Pure.RelationalSchema.Storage.PostgreSQL.Querying datasets. |
GitHub repositories
This package is not used by any popular GitHub repositories.