Skip to content

Improve error message when yield! was used but yield is needed and vice versa #4233

Open

Description

@forki

For newcomers in elmish views it's sometimes not easy to understand when to use yield vs yield!. And the compiler is not really useful here:

let div _ _ = 1

let subView _ _ = [1; 2]



let view model dispatch =
   [
        yield! subView model dispatch
        yield! div [] []
   ]

image

Activity

  1. added this to the Unknown milestone on Aug 25, 2018
  2. isaacabraham commented on Sep 7, 2018

    @isaacabraham
    Contributor

    @cartermp is this ameliorated by some of the changes in F#4.5 regarding yields etc. or not really?

  3. cartermp commented on Sep 7, 2018

    @cartermp
    Contributor

    Only if it involves subtyping, which I don't think is the case with Elmish code.

  4. isaacabraham commented on Apr 21, 2019

    @isaacabraham
    Contributor

    @cartermp @dsyme will this in any way be affected or ameliorated by the work going on to make yield optional?

  5. cartermp commented on Apr 21, 2019

    @cartermp
    Contributor

    I think so, though improper use of yield! will still give the same bad error message.

  6. added
    Area-Diagnosticsmistakes and possible improvements to diagnostics
    and removed on Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions