dotnet / dotnet/fsharp

Query headOrDefault and exactlyOneOrDefault with a struct/tuple

Open
#3,845 13 comments 2 reactions 0 assignees View on GitHub
Area-Queries Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

What should the following syntax do:

```fsharp
open System
open System.Linq

let myQueryable = [|(1,1); (2,2)|].AsQueryable()
let a, b =
query {
for x in myQueryable do
where(x = (3,3))
headOrDefault
}
```

Currently it compiles, but produces a runtime System.NullReferenceException. A thing that we shouldn't have in FSharp, right?

Edit: The reason is...well, read the replies.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.