haskell / haskell/haskell-language-server

Code action to remove redundant constraints can't deal with type operators properly

Open
#1,300 0 comments 1 reaction 0 assignees View on GitHub
component: hls-refactor-plugin type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

### Your environment
Output of `haskell-language-server --probe-tools` or `haskell-language-server-wrapper --probe-tools`:

```sh
haskell-language-server version: 0.9.0.0 (GHC: 8.10.3) (PATH: /home/berberman/.cabal/store/ghc-8.10.3/haskell-language-server-0.9.0.0-81f61f357a41d74a3d6d524b9f8f4949ec5bbcb5dd08161f78f8859c0cd951c1/bin/haskell-language-server)
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: Not found
ghc: 8.10.3
```
Which lsp-client do you use:
vscode

### Steps to reproduce

Create a haskell file like this, then try applying code actions to remove redundant constraints:

```haskell

{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wredundant-constraints #-}

class a ** b

f :: (**) a b => a -> b -> a
f = const

g :: ((**) a b) => a -> b -> a
g = const

h :: ((**) a b, Eq a) => a -> b -> a
h = const

```

### Expected behaviour

It results in:

```haskell

{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wredundant-constraints #-}

class a ** b

f :: a -> b -> a
f = const

g :: a -> b -> a
g = const

h :: a -> b -> a
h = const
```

### Actual behaviour

* `f`'s type signature became `f :: **) a => a -> b -> a`
* no code action populated for `g`
* `h`'s type signature became `h :: (**) a b => a -> b -> a`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.