OpFlow 1.0.6.3

dotnet add package OpFlow --version 1.0.6.3
                    
NuGet\Install-Package OpFlow -Version 1.0.6.3
                    
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="OpFlow" Version="1.0.6.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpFlow" Version="1.0.6.3" />
                    
Directory.Packages.props
<PackageReference Include="OpFlow" />
                    
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 OpFlow --version 1.0.6.3
                    
#r "nuget: OpFlow, 1.0.6.3"
                    
#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 OpFlow@1.0.6.3
                    
#: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=OpFlow&version=1.0.6.3
                    
Install as a Cake Addin
#tool nuget:?package=OpFlow&version=1.0.6.3
                    
Install as a Cake Tool

OpFlow

A minimal, expressive pipeline framework for C#.

OpFlow provides a clean, predictable way to compose operations in C#.
It centers around a single abstraction — Operation<T> — representing either:

  • a successful result, or
  • a failed result with a structured Error.

No magic. No hidden behavior. No alternative syntaxes.
Just a crisp transform canon for building narrative‑driven pipelines.


Why OpFlow?

C# applications often accumulate:

  • scattered error handling
  • inconsistent validation
  • deeply nested try/catch blocks
  • ad‑hoc null checks
  • unpredictable async flows

OpFlow solves this by giving you:

  • One canonical way to compose operations
  • One predictable error model
  • One narrative for how data flows through your system

Everything is explicit.
Everything is discoverable.
Everything is composable.


The Core Abstraction: Operation<T>

An Operation<T> is either:

Success(T result)
Failure(Error error)

This shape is the foundation of OpFlow’s transform canon.


The Transform Canon

OpFlow defines a small, intentional set of operators:

  • Map — transform a successful value
  • Bind — chain dependent operations
  • MapAsync — async transform
  • BindAsync — async chaining
  • Tap — observe without modifying
  • Recover — handle failures
  • Match — unify success/failure
  • Finally — run cleanup logic

These operators live on Operation<T> itself to ensure a single canonical implementation.


The Op Façade

Op is the recommended entry point for creating operations:

Op.Success(value)
Op.Failure<T>(error)
Op.From(value)
Op.From(func)
Op.FromAsync(func)
Op.FromException<T>(ex)
Op.Try(func)
Op.TryAsync(func)

These helpers wrap raw values, exceptions, and tasks into operations so your pipeline can begin cleanly.


Validation

Validation is a first‑class part of the transform canon:

Operation.Validate(...)
Operation.ValidateAll(...)
Operation.ValidateAsync(...)
Operation.ValidateAllAsync(...)

These operators aggregate multiple operations into one, collecting errors when needed.


Example

var result =
    Op.From(() => File.ReadAllText("config.json"))
      .Map(ParseConfig)
      .Bind(ValidateConfig)
      .BindAsync(SaveConfigAsync)
      .Tap(_ => Log("Config saved"))
      .Recover(error => LogError(error))
      .Match(
          onSuccess: _ => "OK",
          onFailure: error => $"Failed: {error.Message}"
      );

This is the OpFlow story:

  • clear
  • sequential
  • explicit
  • readable

Installation

dotnet add package OpFlow

Design Principles

  • One way to do things — no LINQ sugar, no parallel sugar, no duplicates
  • Explicit over implicit — every step is visible
  • Narrative‑driven pipelines — code that reads like a story
  • Minimal surface area — a small API is a powerful API

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OpFlow:

Package Downloads
OpFlow.Converters.NewtonsoftJson

Newtonsoft.Json converters for OpFlow discriminated unions.

GitHub repositories

This package is not used by any popular GitHub repositories.