Page cover image

Welcome

Keep exceptions exceptional

Waystone.Monads is a lightweight, idiomatic C# library that implements two fundamental functional types: Option<T> and Result<T, E>. It is inspired by Rust's std::option and std::result types and brings their power and functionality into the world of C#.

Why this library exists

Most C# codebases default to null and exceptions for absence and failure. That's fine, until it isn't.

Waystone.Monads replaces that with explicit types that make the intent clear at the type level:

  • Option<T> means a value might be there.

  • Result<T, E> means a computation might fail.

Who should use this

You should use this library if:

  • You want to eliminate null and exceptions from business logic

  • You want your exceptions to be exceptional

  • You prefer expressive, explicit code over defensive boilerplate

  • You appreciate functional patterns but still want to write C#

Last updated