Wrapture 1.0.0
See the version list below for details.
dotnet add package Wrapture --version 1.0.0
NuGet\Install-Package Wrapture -Version 1.0.0
<PackageReference Include="Wrapture" Version="1.0.0" />
paket add Wrapture --version 1.0.0
#r "nuget: Wrapture, 1.0.0"
// Install Wrapture as a Cake Addin #addin nuget:?package=Wrapture&version=1.0.0 // Install Wrapture as a Cake Tool #tool nuget:?package=Wrapture&version=1.0.0
Wrapture
Wrapture is a lightweight .NET library designed to bring functional programming abstractions to your applications. By using core types like Result
, Maybe
, Either
, Specification
, and utilities for pagination, Wrapture helps you write clean, declarative, and composable code.
Features
- Result: Encapsulate success or failure states with an expressive API.
- Maybe: Represent optional values without relying on
null
. - Either: Handle computations with two possible outcomes, such as success or error.
- Specification: Encapsulate business rules and make them reusable and composable.
- Pagination: Simplify handling paginated data with
PagedResult
.
Installation
You can install Wrapture via NuGet:
Install-Package Wrapture
Or using the .NET CLI:
dotnet add package Wrapture
Getting Started
Example: Using Result
var result = ProcessData(input)
.Map(Transform)
.Bind(Validate);
result.Match(
success => Console.WriteLine($"Success: {success}"),
error => Console.WriteLine($"Error: {error}")
);
Example: Using Maybe
var maybeValue = FetchOptionalValue();
maybeValue.Match(
some => Console.WriteLine($"Value: {some}"),
none => Console.WriteLine("No value present")
);
Example: Using Either
var either = ParseNumber("123");
either.Match(
left => Console.WriteLine($"Error: {left}"),
right => Console.WriteLine($"Parsed value: {right}")
);
Contributing
Contributions are welcome! Feel free to submit issues or pull requests on GitHub.
License
This project is licensed under the MIT License.
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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Wrapture:
Package | Downloads |
---|---|
YAFLHttp
Fluent API for working with HttpClient |
|
Sanctify
A lightweight library for implementing guard clauses to validate arguments and ensure code reliability. |
GitHub repositories
This package is not used by any popular GitHub repositories.