Skip to content

Lambda case quick action format instance heads #1674

Closed
@eviefp

Description

@eviefp

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 1.0.0.0 (GHC: 8.10.2) (PATH: /nix/store/b3jr5z4hzv4vsysi0g7r1dx2a9ndi1ja-haskell-language-server-1.0.0.0/bin/haskell-language-server-wrapper)
Tool versions found on the $PATH
cabal:		3.4.0.0
stack:		2.5.1.1
ghc:		8.10.2

Which OS do you use: NixOS

Which lsp-client do you use: emacs

Steps to reproduce

When filling in a typed hole in a class method with a lambda case split, the whole instance head/decl gets reformatted. This project has stylish-haskell setup and does not touch instances.

Expected behaviour

Use the code formatter or not touch the instance head.

E.g., for this code:

instance
  ( Cast (GBoolExp b a) (GBoolExp b' a')
  , Cast a a'
  ) => Cast (GBoolExp b a) (GBoolExp b' a') where
    cast = _

When doing "lambda case split" on the _, I get this:

instance (Cast (GBoolExp b a) (GBoolExp b' a'), Cast a a') =>
         Cast (GBoolExp b a) (GBoolExp b' a') where
  cast
    = \case
        (BoolAnd l_gb'a') -> _
        (BoolOr l_gb'a') -> _
        (BoolNot gb'a') -> _
        (BoolExists gb'a') -> _
        (BoolFld a') -> _

What I would expect is this:

instance
  ( Cast (GBoolExp b a) (GBoolExp b' a')
  , Cast a a'
  ) => Cast (GBoolExp b a) (GBoolExp b' a') where
  cast
    = \case
        (BoolAnd l_gb'a') -> _
        (BoolOr l_gb'a') -> _
        (BoolNot gb'a') -> _
        (BoolExists gb'a') -> _
        (BoolFld a') -> _

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: wingmantype: 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