NuGet Package DiscriminatedUnion

Implementation of Discriminated Union and Pattern Matching in C#.

string outputValue = x.Match()
.Case(c => c == "Test", v => "It's Test!")
.Case(v => "It's Not Test!")
.Else(() => "It's None!")
or

var x = new Union(100);

// the type annotations below are optional and only added for clerity.
string value = x.Match()
.Case((string v) => v)
.Case((int c) => c == 100, (int v) => "Keeping It 100.")
.Case((int v) => "Tea?")
.Else(() => "Nothing");

Assert.Equal("Keeping It 100.", value);.

Info

Version: 1.0.0.45
Author(s): David Lewis
Last Update: Friday, August 4, 2017
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/sdedalus/DiscriminatedUnion
NuGet Url: https://www.nuget.org/packages/DiscriminatedUnion


Install
Install-Package DiscriminatedUnion
dotnet add package DiscriminatedUnion
paket add DiscriminatedUnion
DiscriminatedUnion Download (Unzip the "nupkg" after downloading)

2 packages depend on this package.


Tags



STATS

must-have-score

avg-downloads-per-day

1

days-since-last-release

927