Skip to content

Add ofOptionF to Result module - #377

Merged
panesofglass merged 1 commit into
fsprojects:masterfrom
anderslm:master
Oct 21, 2019
Merged

panesofglass merged 1 commit into
fsprojects:masterfrom
anderslm:master

Conversation

@anderslm

@anderslm anderslm commented Oct 2, 2019

Copy link
Copy Markdown

Add Result.ofOptionF in order to create a result from an option using a
function to supply the default value.
Using a function enables the error object to be resolved when needed
instead of up-front.

Add Result.ofOptionF in order to create a result from an option using a
function to supply the default value.
Using a function enables the error object to be resolved when needed
instead of up-front.
@panesofglass

Copy link
Copy Markdown
Contributor

Thank you for your PR. I'm not sure about the naming. Might mapOption be a better name?

@anderslm

anderslm commented Oct 3, 2019

Copy link
Copy Markdown
Author

@panesofglass
And thanks for reviewing!

Maybe it is. I choose the name based on the existing function Result.ofOption and the F convention I picked up from Option.getOrElseF

Do you think I should change the name to mapOption? Is it okay to have .ofOption (o : 'a) and .mapOption (f : unit -> 'a)
or is it better to use the convention from .getOrElse?

@panesofglass

Copy link
Copy Markdown
Contributor

I had forgotten about Option.getOrElse. I'm not sure. Does anyone else have an opinion? @forki @sergey-tihon ?

@panesofglass
panesofglass self-requested a review October 3, 2019 19:09
@anderslm

Copy link
Copy Markdown
Author

I had forgotten about Option.getOrElse. I'm not sure. Does anyone else have an opinion? @forki @sergey-tihon ?

Any update on this?

@panesofglass
panesofglass merged commit c00be22 into fsprojects:master Oct 21, 2019
@panesofglass

Copy link
Copy Markdown
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants