from Hacker News

Danom: Structures for durable programming patterns in C#.

by pimbrouwers on 11/29/24, 2:14 PM with 2 comments

I’m excited to share a project I’ve been working on for the past 8 months called Danom. After spending 6 years writing F#, I found myself in a situation where C# was mandated. I thought to myself, "I wonder if Option and Result functionality would translate effectively into C#?".

Obviously, implementing them was possible, but what would consumption be like? It turns out, it's amazing. There were already some open-source options available, but none of them had an API that I loved. They often allowed direct access to the internal value, which I felt defeated the purpose.

So, I decided to create Danom with a few key goals in mind:

- Opinionated Monads: Focus on Option and Result rather than a more generic Choice type.

- Exhaustive Matching: An API that enforces exhaustive matching to ensure all cases are handled.

- Fluent API: Designed for chaining operations seamlessly.

- Integration: Fully integrated with ASP.NET Core and Fluent Validation.

Danom has exceeded my expectations, making functional programming patterns in C# not only possible but enjoyable. If you’re interested in bringing some of the functional programming paradigms from F# into your C# projects, I’d love for you to check it out.

You can find the project on GitHub: https://github.com/pimbrouwers/danom

Or, on NuGet: https://www.nuget.org/packages/Danom

Looking forward to your feedback and contributions!

  • by pimbrouwers on 11/29/24, 5:10 PM

    I’m excited to share a project I’ve been working on for the past 8 months called Danom. After spending 6 years writing F#, I found myself in a situation where C# was mandated. I thought to myself, "I wonder if Option and Result functionality would translate effectively into C#?".

    Obviously, implementing them was possible, but what would consumption be like? It turns out, it's amazing. There were already some open-source options available, but none of them had an API that I loved. They often allowed direct access to the internal value, which I felt defeated the purpose.

    So, I decided to create Danom with a few key goals in mind:

    - Opinionated Monads: Focus on Option and Result rather than a more generic Choice type.

    - Exhaustive Matching: An API that enforces exhaustive matching to ensure all cases are handled.

    - Fluent API: Designed for chaining operations seamlessly.

    - Integration: Works well with ASP.NET Core and Fluent Validation.

    The pattern has exceeded my expectations, making functional programming patterns in C# not only possible but enjoyable. If you’re interested in bringing some of the functional programming paradigms from F# into your C# projects, I’d love for you to check it out.

    You can find the project here: https://github.com/pimbrouwers/danom.

    Looking forward to your feedback and contributions!

  • by pimbrouwers on 11/29/24, 2:15 PM

    Legend has it, if you play Danom backwards it will reveal the meaning of life.