dunet
C# discriminated union source generator (by domn1995)
ClosedTypeHierarchyDiagnosticSuppressor
Suppresses exhaustiveness warnings for switching (switch statement or expression) on closed type hierarchies (by shuebner)
dunet | ClosedTypeHierarchyDiagnosticSuppressor | |
---|---|---|
3 | 4 | |
475 | 39 | |
- | - | |
8.5 | 0.0 | |
14 days ago | 5 months ago | |
C# | C# | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
dunet
Posts with mentions or reviews of dunet.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-11-01.
-
Rolled my own Result<T,E> type that seems to work better than others.
BUT It is possible to implement it in a pretty good way. The main issue with the majority of existing libraries is that they're not able to guarantee that Error variant matching is exhaustive. Thus I'd recommend the usage of code generators libraries (https://github.com/domn1995/dunet looks like a good choice to start with) to build Result and Error(s) unions in a proper way
-
How do you live without tagged union types?
Or use something like dunet https://github.com/domn1995/dunet
- Dunet: C# discriminated union source generator
ClosedTypeHierarchyDiagnosticSuppressor
Posts with mentions or reviews of ClosedTypeHierarchyDiagnosticSuppressor.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2024-04-30.
-
Borgo is a statically typed language that compiles to Go
It's not the best solution, but an analyzer like [0] covers most of the cases for reference types. For enums and struct DUs in general we'll have to wait for language (or even runtime) support.
[0] https://github.com/shuebner/ClosedTypeHierarchyDiagnosticSup...
-
Is downcasting in this scenario really bad? What are the alternatives?
I don't think you can get around downcasting though, since pattern matching on type is also just that. You can however make it somehwat safer with this nuget package, for as long as csharp doesn't support discriminated unions natively yet.
-
How do you live without tagged union types?
If you are using visual studio you can try https://github.com/shuebner/ClosedTypeHierarchyDiagnosticSuppressor and write abstract record
- Exhaustiveness check for Discriminated Unions in C#
What are some alternatives?
When comparing dunet and ClosedTypeHierarchyDiagnosticSuppressor you can also consider the following projects:
OneOf - Easy to use F#-like ~discriminated~ unions for C# with exhaustive compile time matching
borgo - Borgo is a statically typed language that compiles to Go.
csharp-combinators - Experiments to understand and find practical use cases for combinators.
csharplang - The official repo for the design of the C# programming language
ZeroQL - C# GraphQL client with Linq-like syntax
plato - A simple and efficient cross-platform programming language.
mapperly - A .NET source generator for generating object mappings. No runtime reflection.
func - Library to extend C#'s functional programming capabilities
stronginject - compile time dependency injection for .NET