Skip to content

Commit

Permalink
More work to improve the noParen handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmitchell committed Mar 30, 2020
1 parent 07ca853 commit 1bdfd2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Hint/Match.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ matchIdea' sb declName HintRule{..} parent x = do
let rhs' | Just fun <- extra = rebracket1' $ noLoc (HsApp noExtField fun rhs)
| otherwise = rhs
(e, tpl) = substitute' u rhs'
noParens = [x | L _ (HsApp _ (varToStr -> "_noParen_") (varToStr -> x)) <- universe tpl]
noParens = [varToStr $ fromParen' x | L _ (HsApp _ (varToStr -> "_noParen_") x) <- universe tpl]

tpl <- pure (performSpecial' tpl)
u <- pure (removeParens noParens u)

let res = addBracketTy' (addBracket' parent $ fst $ substitute' u $ unqualify' sa sb rhs')
let res = addBracketTy' (addBracket' parent $ performSpecial' $ fst $ substitute' u $ unqualify' sa sb rhs')
guard $ (freeVars' e Set.\\ Set.filter (not . isUnifyVar . occNameString) (freeVars' rhs')) `Set.isSubsetOf` freeVars' x
-- Check no unexpected new free variables.

Expand Down

0 comments on commit 1bdfd2b

Please sign in to comment.