Galaxus.Functional
is a package that aims to bring FP-style features to C#. Note though, that this is not true functional programming; this package
contains some useful abstractions often found in functional languages.
The style is greatly inspired by the way Rust does this. If you have worked with Rust's std::option or std::result, you will probably feel right at home.
There currently are the following abstractions found inside Galaxus.Functional
:
A type used to explicitly mark the presence or absence of a value. This is an alternative to checking for null
and is similar to e.g.
Haskell's Maybe
or Java's Optional
.
A type for something that does not exist, similar to void
- except that it can be returned and stored as a value.
A type that can be one of several variants, sort of like a discriminated union or an enum with a stored value for each enum member.
A type that explicitly propagates success or error to the caller, similar to used explicitly annotated exceptions. It can be seen as a specialization
of an Either
with the second variant being an error.
No matter how small, we value every contribution! If you wish to contribute,
- Please create an issue first - this way, we can discuss the feature and flesh out the nitty-gritty details
- Fork the repository, implement the feature and submit a pull request
- Once the maintainers have released a new version, your feature will be part of the NuGet package
And always remember the golden rule for every contribution: Be excellent to each other!