Infix operators can cause "Ambiguous infix expression" errors
jgrosso opened this issue · comments
Being fixed by #63.
We shouldn't directly use haskell-src-exts
, since it has no way of determining fixities that haven't been hardwired in.
Maybe we should use HLint's usage of hlint
's Language.Haskell.HLint4.parseModuleEx
(http://hackage.haskell.org/package/hlint-2.2.2/docs/Language-Haskell-HLint4.html#v:parseModuleEx). Note that HLint tries to use GHC's parser in parseModuleEx
, rather than haskell-src-exts
, although it sometimes falls back to HSE. However, piggybacking on that would definitely be better than our current strategy of only using HSE. Furthermore, HLint is actively migrating away from HSE (ndmitchell/hlint#645), so we can also benefit from those further improvements.ghc-lib-parser
also relies on hardwired fixities (https://raw.githubusercontent.com/ndmitchell/hlint/master/src/GHC/Util/Refact/Fixity.hs).
Is there a way to hook into GHC's parser (probably with the precondion that the file or project typechecks, which is a totally valid requirement to be able to convert a file)?
This issue is pretty high-priority, since the converter isn't very useful otherwise.
Maybe we can write the converter as a GHC plugin? Potential references: