nlkl / Optional

A robust option type for C#
MIT License
900 stars 73 forks source link

Is there a reccomended alternative since this project has not been updated since 2018? #77

Open jasikpark opened 3 years ago

nlkl commented 3 years ago

Hi,

My assumption is that most people will be content with "just" nullable reference types, unless explicitly seeking a more functional approach.

Optional should still be useful as-is, although lacking a bit of ergonomics in some areas. The develop branch addresses some of this and adds nullability annotations and better async support, but some work is still needed to stabilize it fully (particularly on the test suite) - contributions there would be greatly appreciated.

Best regards, Nils

jasikpark commented 3 years ago

Thanks for the response 👍

SuperJMN commented 3 years ago

Hi @nlkl! The only problem I'm seeing is that there are use cases that aren't covered yet, to my knowledge. For instance, how do we do await optional.MatchSome(async x => SomeTask(x))?

I'm usually having problems finding async counterparts of the usual methods.

I really hope you could keep up the good work here. I'm using your library extensively!

silkfire commented 3 years ago

@SuperJMN If you're willing you can try out my fork called Ultimately (https://github.com/silkfire/Ultimately). The set of async methods can be extended based on popular feedback. The library could improve a bit on the documenation side but let me know if you need help with anything.

SuperJMN commented 3 years ago

Wow, it looks nice. I'm currently using https://github.com/vkhorikov/CSharpFunctionalExtensions, too.

My goal is to have a library that has proper Maybe and Either types. I really like the library below. I find myself using the Result type a lot. The extension methods it has are pretty handy. Maybe you can get ideas from there or even merge this library that project.

Thanks!

silkfire commented 3 years ago

Feel free to add suggestions as issues on the repository page. I'll take a look at that library when I get some time.

GlennStartin commented 2 years ago

Can I just point out https://github.com/louthy/language-ext as an alternative that is still being heavily updated.

pepelev commented 1 year ago

I forked this repository and added features that I needed, such as:

NuGet

nlkl commented 1 year ago

I forked this repository and added features that I needed, such as:

* [Nullable reference types](https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references) support

* annotation of code with attributes that improves static analysis: [Pure](https://learn.microsoft.com/dotnet/api/system.diagnostics.contracts.pureattribute) and [JetBrains.Annotations](https://www.jetbrains.com/help/resharper/Reference__Code_Annotation_Attributes.html)

* allocation reducing

* `Option<>` and `Option<,>` now readonly structs

* async analogs on `OptionCollectionExtensions`

* `MaxByOrNone()` `MinByOrNone()` methods

* other minor improvments

NuGet

I am open to contributions, so if you are interested in upstreaming your work, feel free to rebase it onto the develop branch and submit a PR.