Haskell-ide-engine: Hlint parser error on `pattern`

Created on 28 Aug 2019  路  2Comments  路  Source: haskell/haskell-ide-engine

Given a module:

module Lib where

foo pattern = pattern

This error message is shown:

/tmp/ghc-mod4106/Lib4105-43.hs:3:5: error:
    parse error on input `pattern'
  module Lib where

> foo pattern = pattern

This is documented in https://github.com/ndmitchell/hlint/issues/607.
Minimal project to reproduce: https://github.com/fendor/hlint-minimal-pattern

This happens because hlint assumes some default extensions. This makes sense, since hlint is normally not aware of a .cabal or package.yaml file, where extensions may be listed. However, HIE is aware of language extensions and could invoke hlint always with the right extensions.

good first issue gardening 馃尡 hlint

Most helpful comment

This project looks exciting, I'd love to start contributing! I can take a stab at this issue and let everyone know how it goes.

All 2 comments

This project looks exciting, I'd love to start contributing! I can take a stab at this issue and let everyone know how it goes.

I think that https://github.com/haskell/haskell-ide-engine/blob/master/src/Haskell/Ide/Engine/Plugin/ApplyRefact.hs#L142 is responsible.
I am not sure what the best way is to tackle the problem, e.g. I dont think the enabled Language Extensions are known in that function, so, that might be tricky.
It is probably sensible to add a test to https://github.com/haskell/haskell-ide-engine/blob/master/test/unit/ApplyRefactPluginSpec.hs that reproduces the problem.

Was this page helpful?
0 / 5 - 0 ratings