Skip to content

Applying hlint lint causes TypeApplication expressions to turn into holes _ #1242

@talw

Description

@talw

Your environment

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

haskell-language-server version: 0.8.0.0 (GHC: 8.10.3) (PATH: /nix/store/px0cwk7xl79yq4b1pvkwaxfkwaswhis1-haskell-language-server-0.8.0.0/bin/haskell-language-server-wrapper)
Tool versions found on the $PATH
cabal:		3.2.0.0
stack:		2.5.1
ghc:		8.10.3

Which lsp-client do you use:
Neovim
Describe your project (alternative: link to the project):
A cabal project
Contents of hie.yaml:

cradle:
  cabal:
    - path: "src"
      component: "lib:something"
  direct:
    arguments:
      - -isrc
      - -ionly-for-ghci
      - -XNoImplicitPrelude

      - -XBangPatterns
      - -XBlockArguments
      - -XDataKinds
      - -XDeriveFunctor
      - -XDeriveGeneric
      - -XDerivingStrategies
      - -XExistentialQuantification
      - -XFlexibleContexts
      - -XFlexibleInstances
      - -XFunctionalDependencies
      - -XGeneralizedNewtypeDeriving
      - -XGADTs
      - -XInstanceSigs
      - -XLambdaCase
      - -XMultiParamTypeClasses
      - -XMultiWayIf
      - -XNamedFieldPuns
      - -XNumericUnderscores
      - -XOverloadedStrings
      - -XRank2Types
      - -XRecordWildCards
      - -XScopedTypeVariables
      - -XStandaloneDeriving
      - -XStrictData
      - -XTupleSections
      - -XTypeApplications
      - -XTypeFamilies
      - -XTypeOperators
      - -XTypeSynonymInstances
      - -XViewPatterns

Steps to reproduce

With the following code apply the suggested lint to remove redundant bracket

a = (readMaybe @Int content)

Expected behaviour

This appears

a = readMaybe @Int content

Actual behaviour

This appears

a = _ content

This happens in the file so even this:

a = readMaybe @Int content

b = (5)

Turns into this:

a = _ content

b = 5

When invoking hlint with apply-refact by themselves through the CLI the
correct behaviour is demonstrated, and so I opened the issue in haskell-language-server
and not in hlint or apply-refact.

The problem seems to be with TypeApplications. The extension IS enabled
in hie.yaml's cradle -> direct -> arguments -> XTypeApplications

It doesn't matter which hlint lint is applied, as far as I can tell.

Metadata

Metadata

Assignees

Labels

component: hls-hlint-plugintype: 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