Skip to content
/ wrap Public

Function Monads for .NET - Monad, Either, Maybe, Result and Id - with railway-oriented programming extension methods.

License

Notifications You must be signed in to change notification settings

bfren/wrap

Repository files navigation

Wrap: Functional Monads for .NET

GitHub release (latest by date including pre-releases) Nuget GitHub
Test Publish Codacy Badge

Functional monads for .NET (including Maybe - see example) for C# - to handle null values and exceptions better. Railway-oriented programming support via Linq extensions, method chaining, and fuly asynchronous throughout.

Types include:

  • Monad<T>
  • Either<TLeft, TRight>
  • Id<T> (support for int, uint, long, ulong and Guid value types)
  • Maybe<T> (either: Some<T> or None)
  • Result<T> (either: Ok<T> or Failure)

View the Wiki for documentation.

History

Although this library is at v1, it brings together some mature projects I have been working on since 2019. It started with a Result implementation which morphed into Maybe - which reached v10 in November 2025 - and I figured it would be best to have both.

At the same time I was maintaining a StrongId library - which reached v8.5 in November 2024 - to avoid using primitives for Entity IDs. I realised the similarities between Result, Maybe and Id and decided to bring them all together in one library: Wrap.

Licence

MIT

Copyright

Copyright (c) 2019-2026 bfren (unless otherwise stated)

About

Function Monads for .NET - Monad, Either, Maybe, Result and Id - with railway-oriented programming extension methods.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Languages