JohnAz.CSharp.UnionTypes
1.0.2
Prefix Reserved
dotnet add package JohnAz.CSharp.UnionTypes --version 1.0.2
NuGet\Install-Package JohnAz.CSharp.UnionTypes -Version 1.0.2
<PackageReference Include="JohnAz.CSharp.UnionTypes" Version="1.0.2" />
paket add JohnAz.CSharp.UnionTypes --version 1.0.2
#r "nuget: JohnAz.CSharp.UnionTypes, 1.0.2"
// Install JohnAz.CSharp.UnionTypes as a Cake Addin #addin nuget:?package=JohnAz.CSharp.UnionTypes&version=1.0.2 // Install JohnAz.CSharp.UnionTypes as a Cake Tool #tool nuget:?package=JohnAz.CSharp.UnionTypes&version=1.0.2
csharp-uniontypes
Languages like F#, Scala and Haskell have special types to represent a choice of a finite set of values. These types are variously called 'Union Types', 'Sum Types' or 'Discriminated Unions (DUs)'.
Union Types are a powerful way of representing choices. They enforce value semantics and can represent choices between other Record and Union types. They are very useful constructs because they can help model the domain of a problem more precisely, and can help eliminate entire classes of runtime bugs.
Modern C# provides record types, which implicitly implement value semantics; and has support for pattern matching - both of which make implementation of Union Types possible, if tedious.
This library relieves us of the tedium of building out boilerplate code for Union Types. Instead, one is able to define Union Types in a DSL with syntax that is familiar to C# users, and have the source-generator based library generate the necessary code to support pattern matching and other idiomatic C# features.
The objects generated are extensible so additional methods can be added to them allowing these Union Types to be used in a rich domain model.
Build Status
Maintainer(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- FParsec (>= 1.1.1)
- FSharp.Core (>= 8.0.200)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.9.2)
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.0.2 | 123 | 7/24/2024 |
1.0.1 | 117 | 7/15/2024 |
1.0.0-alpha | 102 | 5/16/2024 |