Closed dcastro closed 4 years ago
While this is definitely a legitimate bug, is there a reason that you don't just do (unIdent . getIdent -> parent)
instead of (getIdent -> unIdent -> parent)
?
It's an HSE bug but odds are it will go away when we complete the move to GHC. It's also a good hint to add!
Thanks all! I ended up going with unIdent . getIdent
Please add the note about this to the README.
@unclechu I added a note under https://github.com/ndmitchell/hlint/blob/master/README.md#why-do-i-get-a-parse-error
@ndmitchell Cool, but I think it would be better to mention explicitly ViewPatterns extension and that a way to solve it is to not using nested patterns, by replacing them where possible with composed functions.
@unclechu I don't think nested view patterns are sufficiently common to warrant a special mention - there are plenty of other constructs that have got more reports about them, e.g. a variable named pattern
as per #216. If someone showed me data about what were the most common parse errors and their reasons, I'd certainly include the top 2-3 in the README explicitly, but I suspect (with no real evidence!) it's not nested view patterns.
Confirmed works with HEAD that doesn't use HSE for parsing, so fixed in the next release.
The parser fails when you use ViewPatterns twice in the same pattern, e.g.
(f -> g -> a)
I suspect this needs to be reported upstream, but I'm not sure whether that means
ghc-lib-parser
orhaskell-src-extras
.