D20Tek.Functional.AspNetCore
0.9.4
dotnet add package D20Tek.Functional.AspNetCore --version 0.9.4
NuGet\Install-Package D20Tek.Functional.AspNetCore -Version 0.9.4
<PackageReference Include="D20Tek.Functional.AspNetCore" Version="0.9.4" />
paket add D20Tek.Functional.AspNetCore --version 0.9.4
#r "nuget: D20Tek.Functional.AspNetCore, 0.9.4"
// Install D20Tek.Functional.AspNetCore as a Cake Addin #addin nuget:?package=D20Tek.Functional.AspNetCore&version=0.9.4 // Install D20Tek.Functional.AspNetCore as a Cake Tool #tool nuget:?package=D20Tek.Functional.AspNetCore&version=0.9.4
D20Tek.Functional
Introduction
Welcome to D20Tek.Functional code library, this package contains a set of classes that improve the functional programming experience in C#. I based many of the library classes and api on F#'s functional capabilities to ensure smooth usage between the two: classes like Option, Result, and Choice; and methods like Iter, Bind, and Map. I took inspiration for this library (and a couple of the sample games - ChutesAndLadders and MartianTrail) from "Functional Programming in C#" by Simon J Painter (https://github.com/madSimonJ/FunctionalProgrammingWithCSharp).
I added the D20Tek.Functional.AspNetCore library to this project as well. It wraps some common functionality to transform Result<T> objects into appropriate service endpoint responses, or ProblemDetails for errors that occur. This library removes a lot of repetitive code for dealing with results in WebApi development. It's a separate package to minimize dependencies on the base package, and only add that overhead if you need to integrate with ASP.NET.
As of the first version, I did not provide extension methods for arrays, lists, or enumerables that extend the same functional methods (like Iter, Bind, Map, etc). Enumerables in C# already follow a functional paradigm using LINQ, so I didn't want to add confusion by adding methods that do similar things, but with different names. If I get feedback requests to provide those as well, then I will look at incorporating an extension layer on IEnumerables.
There is also an extensive set of sample console applications and simple games that show how to use this package.
Installation
This library is a NuGet package so it is easy to add to your project. To install the package into your solution, you can use the NuGet Package Manager. In PM, please use the following command:
PM > Install-Package D20Tek.Functional -Version 1.0.0
PM > Install-Package D20Tek.Functional.AspNetCore -Version 1.0.0
To install in the Visual Studio UI, go to the Tools menu > "Manage NuGet Packages". Then search for D20Tek.Functional, and install whichever packages you require from there.
Note: This package is still in pre-release because to ensure that the API works cleanly in multiple scenarios. Once it's been used in several projects and the API solidifies, it will move to a stable release.
Usage
Once you've installed the NuGet package, you can start using it in your .NET projects.
Code examples coming soon...
Samples
Feedback
If you use these libraries and have any feedback, bugs, or suggestions, please file them in the Issues section of this repository. I'm still in the process of building these libraries and samples, so any suggestions that would make it more useable are welcome.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net8.0
- D20Tek.Functional (>= 0.9.4)
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 |
---|---|---|
0.9.4 | 98 | 10/17/2024 |
Initial version with basic functional programming helper classes and extension methods.