Skip to content

Type class instances not picked up on reload #3812

@georgefst

Description

@georgefst

When I make an edit to a cabal file, and HLS thus reloads the session, I often see spurious type class instance errors.

See here for a minimal example, where an instance C Bool in Lib.hs is used in Main.hs. If for example I remove -Wall from the cabal file (just saving it without editing is not enough), and only have Main.hs open in VSCode, I see No instance for (C Bool) once HLS is done reloading. It can take some serious kicking to get HLS to pick up the instance. Sometimes it's enough to make some non-trivial edit to Lib.hs, but other times I've had to delete the contents of Lib.hs, edit Main.hs, then restore Lib.hs to get the errors to go away. This has become quite painful in a larger project.

Note that this doesn't happen on initial load. I can restart the LSP server, only load Main.hs and get no error. Even with a completely fresh load, i.e. no entry in ~/.cache/hie-bios.

I haven't bisected, but I'm pretty sure this is a recent regression (2.1 or 2.2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: ghcidemulti-componentIssues relating to multi-component supporttype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions