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                
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="JohnAz.CSharp.UnionTypes" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JohnAz.CSharp.UnionTypes --version 1.0.2                
#r "nuget: JohnAz.CSharp.UnionTypes, 1.0.2"                
#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 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)

There are no supported framework assets in this 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.0.2 123 7/24/2024
1.0.1 117 7/15/2024
1.0.0-alpha 102 5/16/2024