More Option functions
See original GitHub issueIn the F# User Voice forum, there’s a suggestion to add various functions to the Option
module. These include:
Option.getOrDefault : 'a -> 'a option -> 'a
Option.map2: ('a -> 'b -> 'c) -> 'a option -> 'b option -> 'c option
Option.map3: ('a -> 'b -> 'c -> 'd) -> 'a option -> 'b option -> 'c option -> 'd option
I often find that I need better building blocks for option values, and while they’re easy enough to define, I think it would make the F# language more productive if these fundamental functions were already present.
I’ll be happy to write the tests and implementation and send a pull request for this, but I’m opening this issue first, in order to gauge the interest.
If there’s interest, I’ll get started on some pull requests, but if there’s no interest, please close this issue and the User Voice suggestion.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
More Option
The more option is one of the wearable circular UI components. The more option handle can use the elm_layout APIs, because the more...
Read more >Functions with Options
The OptionValue command is a rather magical function, which knows which function you are in, so that you often don't have to supply...
Read more >Better method to adding lots of options in a function
Adding on to Thomas Junk's answer: once your parameters are a handled a bit better, you can split up your functions something like...
Read more >Options - F# | Microsoft Learn
These functions enable options to be used like a collection of zero or one elements. For more information and examples, see the discussion...
Read more >Idiomaticy of using Option<> as a function argument : r/rust
41 votes, 52 comments. Hey rusty people, Is there any reason to avoid using Option<> to represent an optional function argument?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please consider reviewing @vasily-kirichenko answer in this user voice, there seems to be many other existing resources to draw from, should we prepare a RFC so we can discuss naming / signatures to greater extent?
Definitely agree that having more extensive support over
Option
in the core library makes lots of sense.@ploeh @enricosada Yes, basically, feel free to send a PR creating the RFC for any approved-in-principle issue. First in first served. If you want to grab the token then send one doing nothing but renaming the file, and then fill in the further details.