Wrapture 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Wrapture --version 1.0.0                
NuGet\Install-Package Wrapture -Version 1.0.0                
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="Wrapture" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wrapture --version 1.0.0                
#r "nuget: Wrapture, 1.0.0"                
#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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.1.0 56 1/22/2025
1.0.1 101 1/19/2025
1.0.0 65 1/18/2025