Skip to content

Discriminated unions, pattern matching and partial applications for C#

License

Notifications You must be signed in to change notification settings

DavidArno/SuccincT

Repository files navigation

Succinc<T>

Discriminated unions, pattern matching and partial applications for C#

Current project status

Status
Master branch Build Status (master)
Current release NuGet

Overview

Succinc<T> is a .NET library that adds a number of functional features to C#:

  • Discriminated unions,
  • Pattern matching,
  • Partial applications,
  • "Implicitly" typed lambdas,
  • The ability to treat void methods as Unit functions,
  • Replacements for TryParse methods that return an Option<T> (or Maybe<T>, if you prefer), rather than using the out parameter anti-pattern.
  • "cons" support for IEnumerable<T> (add elements to the head of an enumeration, or split an enumeration into its head element and an enumeration containing the remaining items, all without repeatedly enumerating that enumerable).
  • Cycle() methods that endlessly repeat an enumeration or array, again without repeatedly enumerating that enumerable).
  • Replacements for IEnumerable<T>'s XXXOrDefault methods that return an Option<T> (or Maybe<T>, if you prefer), avoiding null and the "did it return a value, or the default?" problem,
  • And finally, as an experimental feature at this stage, forward pipe support.

For more details of each of these feature, please refer to the wiki.

Serialization

V2.2.0 saw the introduction of of JSON.Net serialization support for Succinc<T>. Using the Succinc<T> serializers, all types can now be correctly serialized/deserialized to JSON.

For details, see the Serializing to JSON wiki page.

Current Release

The current release of Succinc<T> is v4.0.0, which is available as a nuget package that supports .NET 4.6.1+, .NET Core v2.0+ and numerous other frameworks (.NET Standard 2.0).

This release also includes SuccincT.Json v4.0.0, which is available as a separate nuget package that supports .NET 4.6.1+, .NET Core v2.0+ and numerous other frameworks (.NET Standard 2.0). SuccincT.Json is dependent on Succinc<T>, so will pull that package in as part of the install. Also, please note that this nuget package is also dependent on the Newtonsoft.JSON v12.0+ nuget package.

What's planned?

The next release is expected to be v4.1.0. For details of what planned, please see the SuccincT Roadmap for details.

Forking and Contributing

If you wish to fork this repo and build it on your own machine, please refer to the Branches page for details of the currently active branches.

If you wish to contribute in any way (from saying "hi" to submitting a PR), please refer to the Contributing page.