question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More Option functions

See original GitHub issue

In 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:closed
  • Created 8 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
smoothdevelopercommented, Feb 23, 2016

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.

0reactions
dsymecommented, Mar 1, 2016

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found