Git Product home page Git Product logo

Comments (7)

zliu41 avatar zliu41 commented on June 15, 2024 3

HLint now supports eta reduce refactoring (ndmitchell/hlint#1085).

from vscode-haskell.

nickolay avatar nickolay commented on June 15, 2024

hlint itself doesn't support refactorings for the "Eta reduce" warning (ndmitchell/hlint#253).

What I think https://github.com/haskell/haskell-ide-engine could do is not suggest unsupported refactorings in reply to the codeAction request.

(Some background: microsoft/language-server-protocol#394, codeAction specification)

Note that some improvements were made in the area of applying hints very recently in haskell/haskell-ide-engine#533

from vscode-haskell.

AlexeyRaga avatar AlexeyRaga commented on June 15, 2024

I guess that we could either filter this diagnostic out on HIE side or maybe it would be possible to supply hlint config to suppress this suggestion...

project-local .hlint.yaml with something like - ignore: {name: Eta reduce} could be used as a workaround.

from vscode-haskell.

zenVentzi avatar zenVentzi commented on June 15, 2024

New to haskell but in a .hs file,

type myFn a = abs a and clicking the Apply hint: Eta reduce does not work. The one below it works but I've seen also other ones that don't that I cannot recall right now. The bottom of the screen stays at(screenshot) + the name of the operation
image

from vscode-haskell.

jneira avatar jneira commented on June 15, 2024

@zenVentzi thanks for reporting the error. iiuc some refactorings work and others don't, right?
could you share the log of the haskell extension? you can find it in view -> output -> Haskell(project)

imagen

from vscode-haskell.

zenVentzi avatar zenVentzi commented on June 15, 2024
2020-12-25 22:18:47.5556638 [ThreadId 11660] - GhcIde.hover entered (ideLogger)
2020-12-25 22:18:47.5666414 [ThreadId 11660] - Hover request at position 3:5 in file: c:\Users\zen_ventzi\Desktop\hs\test.hs
2020-12-25 22:18:47.5976446 [ThreadId 11670] - DocumentHighlight request at position 3:5 in file: c:\Users\zen_ventzi\Desktop\hs\test.hs
2020-12-25 22:18:47.8272657 [ThreadId 11677] - finish: CodeAction (took 0.00s)
2020-12-25 22:18:47.8282695 [ThreadId 11679] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:18:47.8322706 [ThreadId 11681] - finish: importLens (took 0.00s)
2020-12-25 22:18:47.8332716 [ThreadId 11683] - finish: addPragma (took 0.00s)
2020-12-25 22:18:47.8352698 [ThreadId 11685] - finish: retrie (took 0.00s)
2020-12-25 22:18:47.8362683 [ThreadId 11687] - finish: tactic (took 0.00s)
2020-12-25 22:18:47.8362683 [ThreadId 11689] - finish: tactic (took 0.00s)
2020-12-25 22:18:47.8372688 [ThreadId 11691] - finish: tactic (took 0.00s)
2020-12-25 22:18:51.5081679 [ThreadId 11697] - finish: CodeAction (took 0.00s)
2020-12-25 22:18:51.5081679 [ThreadId 11699] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:18:51.510159 [ThreadId 11701] - finish: importLens (took 0.00s)
2020-12-25 22:18:51.5111625 [ThreadId 11703] - finish: addPragma (took 0.00s)
2020-12-25 22:18:51.5151587 [ThreadId 11705] - finish: retrie (took 0.00s)
2020-12-25 22:18:51.5249798 [ThreadId 11707] - finish: tactic (took 0.00s)
2020-12-25 22:18:51.5249798 [ThreadId 11709] - finish: tactic (took 0.00s)
2020-12-25 22:18:51.5249798 [ThreadId 11711] - finish: tactic (took 0.00s)
2020-12-25 22:18:56.6654331 [ThreadId 11717] - hlint:applyOneCmd:file=NormalizedFilePath "C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs"
2020-12-25 22:18:56.6664531 [ThreadId 11718] - hlint:getIdeas:file:NormalizedFilePath "C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs"
2020-12-25 22:18:56.6674521 [ThreadId 11718] - finish: applyHint (took 0.00s)
2020-12-25 22:18:56.6674521 [ThreadId 11717] - applyHint:apply=[("C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs:3:1-14: Warning: Eta reduce\nFound:\n  myFn a = abs a\nPerhaps:\n  myFn = abs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 3, startCol = 1, endLine = 3, endCol = 15}, subts = [("body",SrcSpan {startLine = 3, startCol = 10, endLine = 3, endCol = 13})], orig = "myFn = body"}])]
2020-12-25 22:18:56.7133763 [ThreadId 11720] - finish: hlint (took 0.00s)
haskell-language-server-0.7.1-win32-8.10.1.exe: could not detect mingw toolchain
[Error - 10:18:56 PM] Request workspace/executeCommand failed.
  Message: ExitFailure 1
  Code: -32603 
2020-12-25 22:18:56.7412736 [ThreadId 11726] - finish: CodeAction (took 0.00s)
2020-12-25 22:18:56.7412736 [ThreadId 11728] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:18:56.7433211 [ThreadId 11730] - finish: importLens (took 0.00s)
2020-12-25 22:18:56.7442784 [ThreadId 11732] - finish: addPragma (took 0.00s)
2020-12-25 22:18:56.745272 [ThreadId 11734] - finish: retrie (took 0.00s)
2020-12-25 22:18:56.7464416 [ThreadId 11736] - finish: tactic (took 0.00s)
2020-12-25 22:18:56.7474548 [ThreadId 11740] - finish: tactic (took 0.00s)
2020-12-25 22:18:56.7464416 [ThreadId 11738] - finish: tactic (took 0.00s)

this log is for the Eta reduce not working

2020-12-25 22:22:30.3516328 [ThreadId 11818] - finish: CodeAction (took 0.00s)
2020-12-25 22:22:30.3526188 [ThreadId 11820] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:22:30.3546638 [ThreadId 11822] - finish: importLens (took 0.00s)
2020-12-25 22:22:30.3566304 [ThreadId 11824] - finish: addPragma (took 0.00s)
2020-12-25 22:22:30.3576406 [ThreadId 11826] - finish: retrie (took 0.00s)
2020-12-25 22:22:30.3596595 [ThreadId 11828] - finish: tactic (took 0.00s)
2020-12-25 22:22:30.3606226 [ThreadId 11832] - finish: tactic (took 0.00s)
2020-12-25 22:22:30.3596595 [ThreadId 11830] - finish: tactic (took 0.00s)
fromList [NormalizedFilePath "C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs"]
2020-12-25 22:22:34.6276789 [ThreadId 11839] - finish: Retrie.GhcSessionDeps (took 0.00s)
2020-12-25 22:22:34.6276789 [ThreadId 11841] - finish: Retrie.getBinds (took 0.00s)
hgIgnorePred: hg: readCreateProcessWithExitCode: does not exist (No such file or directory)
gitIgnorePred: fatal: not a git repository (or any of the parent directories): .git

Reading VCS ignore failed! Continuing without ignoring.
stdin:
C:\Users\zen_ventzi\Desktop\hs\test.hs

shellCmd:
xargs grep -l 'abs'
Files:
Files:
C:\Users\zen_ventzi\Desktop\hs\test.hs
2020-12-25 22:22:34.9151699 [ThreadId 11853] - finish: Retrie.GetFileContents (took 0.00s)
2020-12-25 22:22:35.9082548 [ThreadId 11863] - finish: CodeAction (took 0.00s)
2020-12-25 22:22:35.9082548 [ThreadId 11865] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:22:35.909257 [ThreadId 11867] - finish: importLens (took 0.00s)
2020-12-25 22:22:35.9103445 [ThreadId 11869] - finish: addPragma (took 0.00s)
2020-12-25 22:22:35.9113302 [ThreadId 11871] - finish: retrie (took 0.00s)
2020-12-25 22:22:35.9123263 [ThreadId 11873] - finish: tactic (took 0.00s)
2020-12-25 22:22:35.9123263 [ThreadId 11875] - finish: tactic (took 0.00s)
2020-12-25 22:22:35.9133288 [ThreadId 11877] - finish: tactic (took 0.00s)

this log is for Fold not working

from vscode-haskell.

jneira avatar jneira commented on June 15, 2024

Hi, thanks for share the log. Within it we can check the root error: haskell-language-server-0.7.1-win32-8.10.1.exe: could not detect mingw toolchain.
There is a open issue in the haskell-language-server project: haskell/haskell-language-server#615
There you can find the actual situation of the issue and a workaround.

from vscode-haskell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.