haskell-ide-engine icon indicating copy to clipboard operation
haskell-ide-engine copied to clipboard

Hlint parse error with RecordWildCards language extension

Open fimmind opened this issue 4 years ago • 1 comments

Minimal example (app/Main.hs file in standard stack's new template):

{-# LANGUAGE RecordWildCards #-}

data Foo a = Foo {foo :: a, bar :: a}

fun :: Foo a -> a
fun f @ Foo{..} = foo

main :: IO ()
main = pure ()

And it throws such error:

[hlint parser] [I] /tmp/haskell-lsp5450/Main.hs-00023--8855030527756882730.hs:6:12: error:
    parse error on input `{'
  fun :: Foo a -> a
> fun f @ Foo{..} = foo
  
  main :: IO ()

Screenshot (I'm using NeoVim with coc.nvim): 10 02 20_16:50:03:067995852

Coc.nvim settings copied from README.

HIE version:

$ hie --version
Version 1.1, Git revision 49c6185efdec715a4b2954efa7887520f7196cc8 (3775 commits) x86_64 ghc-8.6.5

fimmind avatar Feb 10 '20 14:02 fimmind

I believe this is an underlying bug in haskell-src-exts, and an underlying bug in HLInt. If you change it to:

fun f@Foo{..} = foo

The bug should go away. Furthermore, work is being done to eliminate haskell-src-exts, which will solve this problem for good.

ndmitchell avatar Feb 12 '20 09:02 ndmitchell