Skip to content

Support for F#9 Nullable  #293

@marklam

Description

@marklam

Is your feature request related to a problem? Please describe.
Using the option CE with <Nullable>enable</Nullable> in the .fsproj, some let! declarations need type annotations to compile.

An example is in the repo https://github.com/marklam/Nullness, but the crux of it is:

module Program

open FsToolkit.ErrorHandling

type [<Measure>] m
type [<Measure>] r

type P = | P
type S = | S

let y (s : S option ) (p : P option)=
    option {
        // Needs annotation
        //let! (_s : S) = s
        let! _s = s

        // Needs annotation
        //let! (_p : P) = p
        let! _p = p

        ()
    } |> ignore

[<EntryPoint>]
let main argv =
    0

Describe the solution you'd like
The option CE to work without hints to the type inference.

Describe alternatives you've considered
Adding type hints.

(I also tried rebuilding FsToolkit.ErrorHandling with <Nullable>enable</Nullable> but I didn't know enough about the implementation of Option.bind etc to achieve anything.)

Additional context
This was originally raised as an issue with F#9's nullability changes dotnet/fsharp#17776

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions