Open yairchu opened 5 years ago
Why does this have to be treated specially rather than as a normal infix operator? What does GHC do here?
Why does this have to be treated specially rather than as a normal infix operator?
That's a good question :) I'm not intimately familiar with haskell-src-exts nor GHC, so honestly I don't know for sure. Maybe if I knew why FunCon
required special treatment I'd have a better direction on answering it.
I extrapolated on haskell-src-exts's treatment for (->)
, which is also a special built-in type operator in Haskell, and just made the treatment for (~)
consistent with it.
If you think that this isn't the right fix and have a suggestion for a different approach I'll gladly try implementing it.
The way to tell what is the right thing to do is look at how GHC implements it in its parser.
Perhaps @niklasbroberg which implemented FunCon
this way can offer insight into why it needs to be treated specially, and whether he thinks that reasoning should also apply to ~
?
(not in any way disagreeing with the above claim that the GHC implements it is the right thing to do, just looking for possible shortcuts instead of going into GHC's code)
Bugfix and test for https://github.com/haskell-suite/haskell-src-exts/issues/421 and https://github.com/ndmitchell/hlint/issues/559