`'a option` generates `null`
See original GitHub issueWhat is the best way to test Option
values? I can use obj.ReferenceEquals
to make sure the Option
isn’t null, but it just doesn’t seem right.
// The type ''a option' does not have 'null' as a proper value
let f (x : 'a option) = isNull x
// Ok, passed 100 tests (99% <null>).
[<Property>]
let testOption (x : int option) =
obj.ReferenceEquals(x, null) ==> Prop.collect x true
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
r - Setting an option to NULL
Workaround: nest the (potentially NULL ) value in a list and use that: options(TEST = list(NULL)) getOption("TEST")[[1]] # [1] NULL ...
Read more >Null, Undefined and Option | ReScript Language Manual
It means "a value of type option is either None (representing nothing) or that actual value wrapped in a Some". Note how the...
Read more >Angular <option> for null not working in Visualforce
In salesforce.com Visualforce pages the default option value for null is not being displayed. I have a very simple select component with one ......
Read more >Null Checking | ReSharper Documentation
Generate null checks for exceptions and assertions · Press Alt Enter on a parameter or expression and choose the corresponding context action:.
Read more >Null Values - F# | Microsoft Learn
Instead of null, with an F# option type, you use the option value None if there is no object. You use the option...
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
F# has eager evaluation, so FsCheck can’t prevent it from evaluating the right hand side of
==>
even if the left hand side is false. You should be able to wrap the right side in lazy to prevent this:Of course! Thanks 😃 The bug was in my head as usual.