Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Option.ofNull to help remove nulls #285

Open
baronfel opened this issue Oct 14, 2016 · 0 comments
Open

add Option.ofNull to help remove nulls #285

baronfel opened this issue Oct 14, 2016 · 0 comments

Comments

@baronfel
Copy link
Owner

add Option.ofNull to help remove nulls [6103054]

Submitted by Cameron Taggart on 6/26/2014 12:00:00 AM
13 votes on UserVoice prior to migration

Many APIs and types support the use of null. To help remove null and promote the use of option, It would be good to add a standard function that can be used to wrap nullable types.
May be something like:
type Option<'A> with
static member ofNull (t:'T when 'T : null) = function
| null -> None
| x -> Some x
http://stackoverflow.com/questions/24418816/in-the-f-api-is-there-something-like-option-ofnull

Response

** by fslang-admin on 1/21/2015 12:00:00 AM **

Completed for F# 4.0, see https://visualfsharp.codeplex.com/SourceControl/network/forks/dsyme/cleanup/contribution/7672
Don Syme, F# Language/Library Evolution

Original UserVoice Submission
Archived Uservoice Comments

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

No branches or pull requests

1 participant