Visitar URL original
Triggering plugin when the scrutinee is `VEither _ _` produces broken code · Issue #5120 · haskell/haskell-language-server · GitHub
Skip to content

Triggering plugin when the scrutinee is VEither _ _ produces broken code #5120

Open

Description

@Aster89

Your environment

Which OS do you use? ArchLinux

Which version of GHC do you use and how did you install it? 9.14.1 from GHCup

How is your project built (alternative: link to the project)? See repro steps below.

Which LSP client (editor/plugin) do you use? terminal vim + YCM

Which version of HLS do you use and how did you install it? 2.14.0.0 from GHCup

Have you configured HLS in any way (especially: a hie.yaml file)? No

Steps to reproduce

Define this function

foo = case _ :: VEither [String,Int] Bool of

and trigger case-split.

Expected behaviour

The plugin should add these lines:

  VLeft _ -> _
  VRight _ -> _

Actual behaviour

This line is added:

  Data.Variant.VEither.VEither _ -> _

which is wrong because VEither value constructor is not exported from its module, only the type constructor is.

Debug information

The issue is, the diagnostic looks like this:

Pattern match(es) are non-exhaustive
In a case alternative:
    Patterns of type ‘VEither [String, Int] Bool’ not matched:
        Data.Variant.VEither.VEither (Variant _ _) [GHC-62161]

and since the plugin inspects that to propose the change… well, there's nothing much we can do right now, except maybe returning no action at all.

But surely the first step is to understand what the diagnostic is actually telling us. I should probably look up into this VEither thing. Ok, that was actually easy. The issue is that GHC is suggesting us to use a data constructor, VEither that we can't really use because it's not exported by its module. This issue was already reported to GHC. We'd want instead, that it suggested us to use the two pattern synonyms VLeft and VRight.

Activity

  1. added theissue type on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: hls-case-split-pluginIssues related to the hls-case-split-pluginstatus: blockedNot actionable, because blocked by upstream/GHC etc.type: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions