RopStarterPack 1.1.1

dotnet add package RopStarterPack --version 1.1.1
                    
NuGet\Install-Package RopStarterPack -Version 1.1.1
                    
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="RopStarterPack" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RopStarterPack" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="RopStarterPack" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RopStarterPack --version 1.1.1
                    
#r "nuget: RopStarterPack, 1.1.1"
                    
#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.
#:package RopStarterPack@1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RopStarterPack&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=RopStarterPack&version=1.1.1
                    
Install as a Cake Tool

RopStarterPack

NuGet

Simple Railway Oriented Programming library for C#.

Rationale

Minimal by design. Just essentials. Beginner friendly. Two goals: enforce code consistency and solve error handling.

Install

dotnet add package RopStarterPack

Usage

Define your error type with factories:

using RopStarterPack;

abstract record AppError
{
    public record UserNotFound(string UserId) : AppError;
    public record OrderNotFound(string OrderId) : AppError;
    public record UnknownError(Exception Ex) : AppError;

    // Factories (help type inference)
    public static AppError UserNotFoundErr(string userId) => new UserNotFound(userId);
    public static AppError OrderNotFoundErr(string orderId) => new OrderNotFound(orderId);

    // Catch-all for unhandled exceptions
    public static AppError FromException(Exception ex) => new UnknownError(ex);
}

Wrap external calls:

async Task<Result<Order, AppError>> GetOrderSafe(string orderId) =>
    await Result.From(
        async () => {
            var order = await db.GetOrder(orderId);
            return Result.FromNullable(order, AppError.OrderNotFoundErr(orderId));
        },
        AppError.FromException
    );

async Task<Result<User, AppError>> GetUserSafe(string userId) =>
    await Result.From(
        async () => {
            var user = await db.GetUser(userId);
            return Result.FromNullable(user, AppError.UserNotFoundErr(userId));
        },
        AppError.FromException
    );

Chain operations:

Task<Result<string, AppError>> ProcessOrder(string orderId) =>
    GetOrderSafe(orderId)
        .AndThen(order => GetUserSafe(order.UserId))
        .Map(user => $"Order belongs to {user.Name}");

Handle at the boundary:

var result = await ProcessOrder("order-123");

var response = result.Match(
    ok: msg => Ok(msg),
    err: e => e switch
    {
        AppError.UserNotFound(var id) => NotFound($"User {id} not found"),
        AppError.OrderNotFound(var id) => NotFound($"Order {id} not found"),
        AppError.UnknownError(var ex) => InternalError(ex.Message)
    }
);

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
1.1.1 91 2/23/2026
1.1.0 150 2/9/2026
1.0.4 339 2/5/2026
1.0.3 93 2/5/2026
1.0.2 133 1/5/2026
1.0.1 99 1/5/2026
1.0.0 97 1/5/2026