-
Notifications
You must be signed in to change notification settings - Fork 203
Description
Following on from #1131, when substituting a b into (`f` 1) we are likely to get ((\x_ -> a b _x 1)). The reason relates to the HSE vs GHC migration.
In the before-time, e.g. with
Lines 53 to 60 in 0ba7612
| exp (Var _ (fromNamed -> x)) = lookup x bind | |
| exp (InfixApp s lhs (fromNamed -> x) rhs) = | |
| (\op -> InfixApp s lhs op rhs) <$> lookupOp x | |
| exp (LeftSection s exp (fromNamed -> x)) = | |
| LeftSection s exp <$> lookupOp x | |
| exp (RightSection s (fromNamed -> x) exp) = | |
| (\op -> RightSection s op exp) <$> lookupOp x | |
| exp _ = Nothing |
f for the showed version of a b. And if that was an expression, then you were in trouble - but we implicitly expected no one to do that.
In the now-time, we substitute directly, and the lines at https://github.com/ndmitchell/hlint/blob/master/src/GHC/Util/Unify.hs#L73-L81 are totally useless. The GHC syntax for OpApp etc directly contain an expression, so the substitution happens even though syntactically it can't be written. And then GHC pretty prints it with the made up x_ and extra backets.
We shouldn't be deferring to GHC. Either we should ban such expansion and fail the substitution. Or we should support it and desugar it ourselves. I'm not sure.